Closed GreenXenith closed 5 years ago
Okay. Please enable debug mode, so we can see which working dir and cmd SublimeLinter executes here.
You can also open the Sublime console and run
window.folders()
This should list the 'attached' folders, just to be sure Sublime reads that project file correctly. It can also be a difference if you open a project, or open a folder via subl .
.
Thankyou @kaste for looking into this.
Log shows
SublimeLinter: #1 linter.py:1263: Running ...
/home/user/.hiddenfolder/subfolder (working dir)
$ cat subfolder/init.lua | /usr/local/bin/luacheck - --formatter=plain --codes --ranges --filename /home/user/.hiddenfolder/subfolder/subsubfolder/init.lua
and window.folders()
returns
>>> window.folders()
['/home/user/.hiddenfolder/subfolder']
Which means it is finding everything just fine.. I think.
Note: The log prints the same thing when using the file link instead, the only different output is from window.folders()
.
And what do you execute on the command line?
Can you also try piping in the file on the command line bc linters can of course work okay when given a filename and then have bugs if they receive the file via stdin.
Did you mangle the output? Otherwise, ' $ cat subfolder/init.lua |' is probably a small visual bug in the log formatter.
And what do you execute on the command line?
luacheck ~/.hiddenfolder/subfolder/subsubfolder/init.lua
Which works.
However, when I use
luacheck --filename = ~/.hiddenfolder/subfolder/subsubfolder/
it cant find the config file. Which is odd because I think I managed to make it work before.
Did you mangle the output?
Nope, that's what it shows. Well, I am replacing a few folder names, if that is what you mean.
Can you also try piping in the file on the command line
Unsure how I would do this.
luacheck --filename = ~/.hiddenfolder/subfolder/subsubfolder/
The =
probably is not a thing.
Afaik, the working dir is the important part bc luacheck starts at that dir when searching for a config file.
Using stdin, basically means cat myfile.lua | luacheck - --filename myfile.lua
.
Instead of the ugly work around, you could btw also just tell luacheck which config it should use.
In the project settings:
{
"folders": [...],
"settings": {
"SublimeLinter.linters.luacheck.args": "--config path/to/config"
}
}
The = probably is not a thing.
I would have thought so too, if I didn't get a Error: missing argument 'files'
when I didn't use it.
Running cat /home/user/.hiddenfile/subfolder/subsubfolder/init.lua | luacheck - --filename init.lua
from terminal still doesn't find the config.
Instead of the ugly work around, you could btw also just tell luacheck which config it should use.
This whole settings thing doesn't seem to be documented too well. Anyway, yes, that works. Still annoying that it cant find it recursively on it's own though.
Actually, where is your config file located?
Config file is located in same folder as init.lua
(subsubfolder
), however I've tried moving it to subfolder
with no success.
Still, the working dir here is essential as I said, so
"SublimeLinter.linters.luacheck.working_dir": "$folder/subsubfolder" // or: "$file_path"
might be an option as well.
That seems to work too.
🙌
Closed because this seems to be resolved. @kaste If we do need to do something here, can you formulate something terse and actionable?
For this linter the default working dir should probably be file_path.
OS: Xubuntu 18.04 Project settings as follows:
luacheck linter fails to find the .luacheckrc, yet lints the file just fine (without my wanted config, of course).
Ugly workaround: Create file link to
subfolder
outside of.hiddenfolder
, use this as file path instead.Should be noted that running luacheck from command line yields no problems finding the .luacheckrc (so it is not a problem with luacheck).
How I found this: I deleted the folder that the project was originally set to display a file tree for (which was a normal folder within
user
). Once I changed the path to the new folder, the linter stopped utilizing my .luacheckrc file, and I spent an hour or two trying in vain to figure out why it broke (my original thought was that editing the project settings broke it, but that would be absurd). When I tried setting it to a folder outside the hidden file, it started working again. Which then led me to test this.I hope this gets fixed if possible, otherwise I can live with the ugly workaround.