Issues with completion on some files
faustinoaq opened this issue ยท 15 comments
@laginha87 I knew I had some issues with auto-completion feature and I have found them, sometimes the completion is broken in projects with sub directories. And keep working only in the main project file.
In the example below, I tried scry master and tested completion on all files, (baz.cr
, bar.cr
and foo.cr
) and no one works but only console.cr
. No matter where I put them, completion just work on one file, the main file console.cr
for the project console
Full logs here: https://gist.github.com/faustinoaq/65b39e810dc1e4a6a3456bb0286d48e6
BTW, There's no errors in that project and also I reloaded VSCode before trying to use auto-completion
Also, if you see the logs, scry is logging something like: Couldn't find type ...
, Why? ๐
hmm that is weird, I'll look into it.
The couldn't find type is thrown when it can't find the type in the dependencies of the file you're on.
So, looks like some of my files are not being included in the auto-completion database because some strange reason ๐
@laginha87 I checked the logs and the file file:///home/main/Projects/console/src/console/baz.cr
was included successfully in the dependency graph, although completion doesn't work in that file as you can see in my gif.
Seems there is something wrong with these lines:
scry/src/scry/completion/dependency_graph.cr
Lines 77 to 79 in bf2660b
@laginha87 Can you reproduce this issue? ๐
I did some test, this bugs seems to be related to the require
system and sub directory structure of the project, (maybe names mismatch).
If a try a new clean crystal project crystal init app bar
, then auto-completion only works on src/bar.cr
:
but not on src/bar/version.cr
Surprisingly If a try an amber project, auto-completion feature work without problems in all files: (even in files outside src
folder)
So, I really don't know what is happening here ๐ I think we need to review this code:
scry/src/scry/completion/dependency_graph.cr
Lines 67 to 79 in bf2660b
@laginha87 here are the scry logs for crystal init app bar
auto-completion inside
src/bar/version.cr
doesn't work
Sorry for so many comments and Thank you for your help! ๐ ๐
No worries, sorry I haven't had time to look at these yet.
Hi @laginha87 I guess I fixed something in #92
Std lib Completion for all crystal files is working now, even in untitled files ๐
Wow, I think #92 fixes this definitely, see my comment: #92 (comment)
It's very odd, cause in that case reload would have fixed issue (temporarily at least)
@laginha87 maybe this issue was caused by #59 and #91, so when the Missing hash key
was fixed in #92 then this issue got fixed as well.