-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to skip some paths from linting #1037
Comments
@mgzenitech Can you share some more details about the filenames you have in place and also explain what do you mean by "linting"? Do you mean the basic diagnostics resulting from invalid configuration? Generally speaking if a file has Assuming your ERB files are called e.g. |
Hi @radeksimko ! For example I have directories:
I would like disable linting/validation on |
Thank you for the extra context. Is there a reason you cannot give these ERB templates in
That should then exclude them automatically? Alternatively you could assign these files different language in the bottom right bar. I am not sure if there's a way to do this for a whole folder and persist it somehow somewhere in VS Code settings. Either way that should exclude them from being processed by the extension and avoid the diagnostics being published for these files. It would also help VS Code in highlighting the ERB syntax in those files correctly, either using the built-in Ruby grammar (assuming you use Highlighting of embedded languages (like ERB + TF) is something we have briefly discussed within #403 in the context of markdown, but I think the problem is pretty much the same here. I'm not sure yet how exactly we'll end up solving the problem, but I suppose it's a problem of combined languages within ERB templates, just like Markdown has the same problem - i.e. you are typically templating syntax of another language. So maybe the Ruby or ERB grammar needs to be injecting all kinds of other grammars to account for this. Either way - if there's one language to choose from for the files you described I'd say ERB/Ruby is a better choice than Terraform - and that is what the file extension should also indicate and that's what can help in highlighting these files outside of VS Code too (e.g. on GitHub). I'm not quite convinced there is need for extension-specific mechanism to exclude files - at least I expect VS Code itself to control what languages are assigned to what files and then our extension can act based on these languages (or not). |
Impossible to do that as Terraspace framework specifically searches for
or something similar? |
I think there may be misunderstanding wrt the origin of the diagnostics. Generally these do not come from a "linter". This is merely a result of files being loaded & parsed by the extension, either by the The extension -> language mapping is done by the static extension settings Lines 56 to 82 in dda20fc
and the highlighting (i.e. which file to highlight how) by another static grammar settings Lines 83 to 94 in dda20fc
This gives us no way to dynamically exclude any patterns from there. I still believe that ERB templates should be communicated as such instead of reusing Terraform's own file extension ( I would encourage you to raise this to Terraspace and propose that they establish a convention such as We may consider somehow highlighting files which embed Terraform syntax in the future but this would likely only involve highlighting since LSP doesn't provide any "native" way to process embedded files and highlighting of such files also isn't simple today (involves various hacks). Either way for any such combined files (Markdown or ERB) there still has to be clarity about what these files are and naming them With that in mind I'm going to close this in favour of #403 which I rewrote to include ERB as well. Feel free to follow that issue. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Versions
This feature does not yet exist in:
Extension
Language Server
Problem Statement
Currently every single .tf file is linted. My specific case is that we use ERB to prebuild .tf files and all of the files with ERB template syntax is being shown as having problems even though they are not real .tf files.
(I can do ... today but ...)
When I do ... then ...
It would be helpful if ...
Expected User Experience
I would be able to see ... when I click/type ...
Proposal
References
The text was updated successfully, but these errors were encountered: