-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module load redirection logic in @theia/plugin-ext-vscode misbehaves in the presence of a symlink #12840
Comments
Hi @jcortell68, How about the following fix for this issue: In the above change, I am using nodejs' "realpathSync" FS API to resolve any symlinks in the plugin folder to their actual path which later would be used by the "findPlugin" function. Do you perhaps see any downsides to this approach? If not I'll raise a PR and hopefully this issue would be resolved Edit: This seems to fix #12828 as you suggested |
@vatsal-uppal-1997 Works like a charm. Thanks! Assuming that |
NICE! I've closed that ticket as it is effectively a duplicate. |
@vince-fugnitto Raised a PR to fix this issue, requesting a review: |
This happens only in the development environment of someone writing a VS Code extension for Theia. I don't think it happens in a deployed installation of the app, since I don't think there's a symlink at play there. The Theia documentation recommends the use of a
plugin
symlink in the monorepo. See the recommendation here.Bug Description:
The problem is in the super simple implementation of the local utility function
findPlugin
hereThat module keeps a cache of API objects--one for each VS Code extension the Theia app loads. The idea is that if VS Code extension XYZ has 50 modules which each do, e.g.,
all 50 imports will end up getting the same (cached) module exports object.
The problem is that
findPlugin
is too simple and doesn't consider the duplicity that can happen when symlinks are involved. ThePlugin.pluginFolder
uses the symlink; however theparent
object passed into themodule._load()
function does not use the symlink.By example:
Note that
plugins
is not present in the latter, thusfindPlugin
returnsundefined
.I fear there might be functional problems that results from this. Consider that the API factory takes a
Plugin
object. And if we look at the factory implementation, we see the plugin argument is used to create many parts of the API. When the match described above fails due to the symlink, the extension is given a default singleton API object object that is created usingemptyPlugin
, thus lacking context that may be necessary for the vscode API implementation to work correctly. And in fact, I wonder if that's not the root cause of #12828Steps to Reproduce:
Invoke the Hello World command contribution.
In the stdout, you'll see:
Additional Information
The text was updated successfully, but these errors were encountered: