Open wigging opened 3 years ago
I'm using Sublime Text 4 with the LSP and LSP-julia plugins.
Nice, that indicates that the installation logic for the language server that I recently added, seems to work 🙂
The LSP appears to activate the correct environment but the autocompletion and linter do not work.
I guess this warning for the unknown symbol is only for the "MyProj" package and the missing autocompletions only for functions from MyProj? I'm not entirely sure, but I think the language server only knows about packages that are specified in Project.toml or from the Julia stdlib, and if you have a separate file (example.jl) in the root package directory, the import MyProj
cannot be resolved. I can see the same behavior in VS Code (with the "julia.lint.missingrefs" setting set to a value different from "none"), and I assume it is the reason why the "test" folder is excluded from linting by default. I found the following issue in the VSCode repo, which might be related: https://github.com/julia-vscode/julia-vscode/issues/2224
I guess it should work correctly if you add include("src/MyProj.jl")
as a first line before import MyProj
.
Yes, the warnings are for MyProj as displayed below.
example.jl:
1:8 warning Missing reference: MyProj Julia:Julia
4:9 warning Missing reference: MyProj Julia:Julia
5:9 warning Missing reference: MyProj Julia:Julia
If I include the MyProj
module from src
(as shown below) then the missing reference warnings go away. But I shouldn't need to include the module. The original example script runs fine in the activated project environment and doesn't need the include statement.
include("src/MyProj.jl")
import MyProj
function main()
a = MyProj.adder(3, 2)
d = MyProj.divider(18, 9)
println("a is $a")
println("d is $d")
end
main()
I have faced the same issue , after correcting the include
it worked fine but only for functions and vars inside the project while I still get Missing Reference
error for
dependencies added via project.toml
.
For eg this works
include("src/utils.jl")
addTwoNums(23)
addStrings(23)
addStrings("23")
this doesn't (i.e linted as warning Missing reference: Statistics Julia:Julia
)
using Statistics
median([1:10])
std(rand(10))
# %%
std(rand(10, 2),corrected=false)
@prassee Your example with Statistics works for me, i.e. I don't get a "Missing reference" warning even with "julia.lint.missingrefs": "all"
in the settings. And things like hover info for the median
and std
functions should work too - does that work on your side?
Are you sure that you have activated the correct environment in Sublime Text? The environment/folder name should be displayed in the status bar and you can manually change the environment via "LSP-julia: Change Current Environment" from the command palette.
There is some code to automatically activate the environment (if the opened file is part of an environment) when the language server starts, but it might still have a few edge cases where it doesn't work correctly.
I have the below settings
{
"settings": {
"julia.lint.missingrefs": "all" (default )
}
}
I have julia (v1.6.2)on path and using the latest code cloned in to ST4 packages. Below is the version info for SymbolServer and LanguageServer
[b9b8584e] JSONRPC v1.3.3
[2b0e0bc5] LanguageServer v4.0.0
[cf896787] SymbolServer v7.0.0
Attached is the screenshot
I don't know whats going wrong here .. pls help
After updated to the latest code , I no more face this issue hence closing the issue
I'm using Sublime Text 4 with the LSP and LSP-julia plugins. I have a Julia project with the following file structure:
The LSP appears to activate the correct environment but the autocompletion and linter do not work.