julia-vscode / LanguageServer.jl

An implementation of the Microsoft Language Server Protocol for the Julia language.
Other
361 stars 78 forks source link

Sublime Text: Packages marked as missing references #796

Open fredcallaway opened 4 years ago

fredcallaway commented 4 years ago

After following the directions here all of my non-base packages are marked as missing. I think this might be because contrib/languageserver.sh does not pass an env_path. This probably should be handled correctly down stream, but it seems that it isn't (maybe due to #391). If I edit contrib/languageserver.sh to specify an environment, the packages are correctly found.

I think @randy3k contributed this file, so he might have the best idea about what's going on.

jwortmann commented 4 years ago

Hi, I believe your assumption is correct that you need to pass the env_path to your project folder in the starting options. The description on readthedocs is actually a bit outdated, because some configuration keys changed at the current language server versions. And some features of the server are not available only with a simple user configuration. For personal use I made a plugin for the LSP package at https://github.com/jwortmann/LSP-julia which adds a command to easily change the current environment, and per default it will change the env_path to a currently opened Julia project when the language server starts (can be disabled in settings). In general, I would suggest to always open a folder in Sublime Text, because e.g. the linter only works in that case. My plugin is not on Package Control yet, but you could clone that repo into your Packages directory for now. Just be aware that I will probably change the plugin to use new API functions as soon as ST 4 becomes publicly available (hopefully soon), because the LSP package for ST 4 has got a lot of new and enhanced features compared to ST 3. In that case, the plugin will break on ST 3.

Additionally, if you install the Terminus package from Package Control, the plugin will add functionality to run code blocks with Alt+Enter like in VS Code. The downside of the plugin is that it doesn't use the languageserver.sh file, and therfore LSP will leave orphaned Julia processes on close in ST 3. For me, that's not a big deal because these will have 0% CPU and 0.1 MB RAM usage after a while, and I can kill them with the task manager if I want or it will happen when I turn off my PC automatically (I cannot use the Shell-script anyway because I'm on Windows). I think that this problem is also resolved already on ST 4.

Edit: the plugin I mentioned has been moved to https://github.com/sublimelsp/LSP-julia now. If anyone made a clone of my repo, adjust the URL via git remote set-url origin https://github.com/sublimelsp/LSP-julia. It should work fine on Sublime Text 3, but if there are any problems or feature requests, please open an issue there. (cc @fredcallaway, @randy3k )

Regarding this issue here, I believe there are some considerations to remove the env_path from the starting options in the future and use the protocol's configuration system instead, see #748. In that case it gets fetched via the workspace/configuration request, and clients can send changes via workspace/didChangeConfiguration notification. As a workaround, #772 might make it easier for now (I haven't tried it yet), but that still seems to require a small adjustment in contrib/languageserver.sh.

prassee commented 3 years ago

Any update on this , I still face this issue on latest stable release of ST4