Ignore Files setting and `--ignore-files` in `.streerc` both have no effect
chasestubblefield opened this issue · 5 comments
This may be due to a limitation of the language server itself, but I cannot get the extension to ignore files.
Assume I want to ignore checking and formatting for the file db/schema.rb in my Rails project. With the following .streerc file in the project root:
--ignore-files='db/schema.rb'
I can successfully have the CLI and Rake tasks ignore the file. However, the extension will always format the file, which is annoying because I like to use Format On Save. The language server does seem to pick up my other settings in .streerc, however.
Here's what I have tried. In each case I have restarted the language server. Also, it may be worth noting I am using a bundled syntax_tree.
- Ignore Files set to
db/schema.rb - Ignore Files set to
schema.rb - Ignore Files set to
**/schema.rb - Ignore Files set to
'**/schema.rb'(quoted to avoid shell expansion) - Ignore Files set to
/Users/chase/dev/my_project/db/schema.rb(Absolute path)
I expect the extension to do nothing when asked to format an ignored file either directly with the Command Pallete or with Format On Save.
If I need to dive into the language server and extension code to debug this, I will, because currently it's a bit annoying. I plan to generate a "TODO" list of files that fail stree check and adding them to my .streerc, so I can incrementally format my project.
Seems like it is a limitation of the Language Server directly. It seems to ignore all command-line arguments (including from .streerc) except for print_width: https://github.com/ruby-syntax-tree/syntax_tree/blob/8fbcd1bc52e7e3f85bbf8d46cf93d0182a7a04ac/lib/syntax_tree/cli.rb#L504
Which version of the plugin and which version of syntax tree are you running? This was fixed in a recent version.
Gem version 5.0.1, extension version 0.5.1, which are both latest I believe. Just to be sure:
$ bundle info syntax_tree | head -n 1
* syntax_tree (5.0.1)
$ code --list-extensions --show-versions | grep ruby-syntax-tree
ruby-syntax-tree.vscode-syntax-tree@0.5.1Just to clarify, the gem CLI correctly ignores based on my .streerc:
$ bundle exec stree check db/schema.rb
All files matched expected format.With the default extension settings however, opening db/schema.rb and saving (with Format on Save) still formats the file.
I tried using the setting "syntaxTree.ignoreFiles": "db/schema.rb", which restarted the LSP. Output channel shows:
Starting language server: bundle exec stree lsp --ignore-files=db/schema.rb
But I still get the same result when saving the file.
I'm experiencing this also, fwiw. v0.5.1 of the extension and 5.3.0 of the gem. This appears to be an issue with the syntax_tree library's lsp implementation. It only accepts print width as an option.