kotlin-language-server icon indicating copy to clipboard operation
kotlin-language-server copied to clipboard

Incorrectly excluded directory

Open fw623 opened this issue 1 year ago • 1 comments

A problem I had was that some references remained unresolved by the language server although they were correct. The problem turned out to be that they were under a target directory, which is excluded by the language server, as seen in the following snippet.

https://github.com/fwcd/kotlin-language-server/blob/bc5309964d24053dd80aed193975629c3e8546ca/shared/src/main/kotlin/org/javacs/kt/SourceExclusions.kt#L13

Solution

I think ideally, the language server should do something more sensible than using the hardcoded exclusion rules and allow customization of that behaviour via options.

But for now, a workaround is to symlink the incorrectly excluded directories to a non-excluded name. E.g. in my case I used ln -s target trgt.

fw623 avatar Apr 27 '23 16:04 fw623

I agree, the current solution is not optimal and we should either query the build system (ideal) or at least the .gitignore as a heuristic on which files to exclude. Letting the user configure these exclusions manually could be convenient too. There's a todo comment a few lines above that addresses this:

https://github.com/fwcd/kotlin-language-server/blob/bc5309964d24053dd80aed193975629c3e8546ca/shared/src/main/kotlin/org/javacs/kt/SourceExclusions.kt#L10-L11

fwcd avatar May 02 '23 23:05 fwcd