eirikpre / VSCode-SystemVerilog

SystemVerilog support in VS Code
MIT License
128 stars 50 forks source link

Support Predifined Variables for "launchConfiguration" #79

Closed xusine closed 3 years ago

xusine commented 4 years ago

https://code.visualstudio.com/docs/editor/variables-reference

At present, the lint command is "launchConfiguration" + ${file}, and any VSCode predefined variables are not supported. However, it's quite normal to preprocess the opening file before pass it to the linter.

eirikpre commented 4 years ago

Yep, preprocessing is not implemented yet. Work on-going there, but it will take some time before I can make it.

eirikpre commented 4 years ago

Hey @Xusine1131 Have you tried using a task? (Tasks can now be defined for a user, instead of per workspace)

Snippet here: https://github.com/eirikpre/VSCode-SystemVerilog/issues/63#issuecomment-618331523

It is not shown in the example, but you can use the attribute 'env' as well.

xusine commented 4 years ago

Thank you @eirikpre It's nice to regard linting as a task. But I think it's not very convenient since I let the linter automatically run when saving files. Is it possible to automatically run a task on saving the file?

eirikpre commented 4 years ago

Yes, I'm certain I've seen an extension that runs a task on save :) I haven't tried it myself, but maybe this will do the trick? https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave

xusine commented 4 years ago

Thank you @eirikpre ! I think you can refer to that extension since it can run commands with predicated Variables. If the parsing function is found, this issue can be directly solved!

xusine commented 4 years ago

https://github.com/emeraldwalk/vscode-runonsave/blob/master/src/extension.ts#L195 I think what he did is just replacement.

eirikpre commented 4 years ago

Just keeping the task open to formally describe this on the wiki and remove the internal launch of linters :)