Closed pdesaulniers closed 4 years ago
Yeah I have this too, it basically makes multiple files unusable, I will try to look at why it's happening but this is a pretty major thing.
@factubsio Great! I think it's a matter of setting the right URI here: https://github.com/teal-language/vscode-teal/blob/1985c89ed5f2572e119b4125eb4ba278be276eb9/server/server.ts#L240
Ah ace, I will dig into this thanks!
Well this is fun, it doesn't always exhibit the behaviour. 🤔
Ok so I can get rid of the wrong errors but we lose the errors from the required file.
The issue is we need to get a full uri of the required file, but that is resolved inside tl check which is, among other things, dependent on the tlconfig.lua
.
I think the best path (no pun intended) is for tl check to have an option, via an option in tlconfig and/or a command line arg, to return full paths for errors. I will open an issue/PR there.
Yeah, sounds like a good idea!
One potential issue though is that, right now, the language server copies the current text buffer into a temporary file and runs tl check
on that file. That way, we don't have to save the .tl
file to trigger the type-checking.
The URI should not point towards the temporary file, but towards the actual document...
Can you find some way around this?
😬 I wonder if it would be OK to only show errors for files in your workspace.
As far as I can tell tl check
always returns paths relative to where you run it from, even with tlconfig.lua
includes.
i.e.
.
├── inc_dir
│  ├── point.d.tl
│  └── test.tl
└── tlconfig.lua
1 directory, 3 files
mcw@DESKTOP-A0LAQ1C:/mnt/c/Users/micha/fullpatherr$ cat tlconfig.lua
return {
include = {
"inc_dir"
}
}
mcw@DESKTOP-A0LAQ1C:/mnt/c/Users/micha/fullpatherr$ ../tl/tl check inc_dir/test.tl
========================================
1 syntax error:
inc_dir/point.d.tl:6:5: attempt to redeclare field 'y' (only functions can be overloaded)
mcw@DESKTOP-A0LAQ1C:/mnt/c/Users/micha/fullpatherr$
which means I think we can just check if (pseudocode): ${workspacePath} .. / .. errorPath
exists, and only return the error if it does?
This means errors for files outside the workspace would be dropped. I am seeing what tl gives if the error is outside the workspace, but the workspace also contains a file with that name.
Also, whenever the language server crashes vscode crashes with Error: Cannot find module 'vscode'
- I have done an npm install but that doesn't seem to fix the issue, do you know what I'm supposed to do to set up vscode properly to debug?
(I can set breakpoints fine, but if it crashes it crashes hard).
Oh gosh it's because I'm in the language server itself...
If
test1.tl
requirestest2.tl
andtest2.tl
contains errors, then the squiggly lines fortest2.tl
will show up intest1.tl
...