Open oyarsa opened 5 months ago
Hi @oyarsa, thanks for filing the issue. This is a limitation because the Raku Navigator is not taking file locations into account while compiling, so any relative pathing (e.g. $?FILE
) is not going to work correctly. The file does not compile in place because a user may be editing the file, so we need to compile the unsaved version that does not exist on disk.
Currently, the code and file-path are both passed into navigator.raku, but file-path is not currently utilized. This would be a great improvement, but I'm not currently sure how to do it. If anyone has any suggestions, or would like to make a pull request, that would be great. https://github.com/bscan/RakuNavigator/blob/master/server/src/raku/navigator.raku
Another option available is using the setting raku.includePaths
. This is an array that lets you add things to the search path and you could add "raku.includePaths": ["/path/to/folder/lib"]
I should probably also start adding "./lib" by default. In the Perl version, when you have a folder or workspace open, it will automatically add the ./lib
folder as an include path.
https://github.com/bscan/PerlNavigator/blob/1f3e38e74277f1f95b6a4a10012a71eb9826b109/server/src/utils.ts#L31
I'm getting an error that the editor cannot find the lib when in the test file, but
prove6
runs correctly.Here is the folder structure:
And here's the top of the test file:
This is the full error:
This is from Exercism's Pangram exercise: https://exercism.org/tracks/raku/exercises/pangram
I'm running the Raku VS Code extension v0.3.2, Rakudo v2024.02 on macOS 14.2.1 (M1 Pro).