Open hauserx opened 6 months ago
Hmm, do you know what your indentation settings are for your editor, of if the indentation in the example is mixed (e.g. tabs for one line and spaces for another)? I'm not able to reproduce this running on VSCode with tabs converted to four spaces, which is how starpls
treats tabs.
Alternatively, if you upload an example repro .bzl
file, I can try looking to see if something unexpected is happening with indentation.
I am using fresh install of neovim in WSL2 and looks by default it was using windows CRLF endlines... The issue is fixed by using unix endlines. So seems this issue maybe by under windows/when using CRLF endlines.
Attaching small script to reproduce the issue: test_starpls_crlf.txt
Output:
Diagnostics: {
"jsonrpc": "2.0",
"method": "textDocument/publishDiagnostics",
"params": {
"diagnostics": [
{
"message": "Unexpected indentation",
"range": {
"end": {
"character": 0,
"line": 3
},
"start": {
"character": 0,
"line": 3
}
},
"severity": 1,
"source": "starpls"
}
],
"uri": "file:///fakepath/sample.bzl",
"version": 1
}
}
Thank you! I use WSL2 but not with CRLF line endings so admittedly haven't actually tested this too much 😅 I'll try to have a fix out soon, should be straightforward
It would be nice to have support for CRLF
as this should be valid for Starlark files.
In the meantime I noticed that buildifier
by default replaces CRLF
with LF
.
While this is not supported by starpls
, I'm simply conveying using LF
EOL
for all starlark
files with the below:
buildifier -config=off -r .
and at .vscode\settings.json
:
"[starlark]": {
"files.eol": "\n"
}
Simple example:
Result: