Closed Araxeus closed 1 year ago
Thank you very much for the author's development. I also have the same requirement. I expect the plug-in to take effect only in the file with the suffix '.user.js'
That's a good idea. Maybe i can add an extension option like: Extension activate only in the .user.js
file. Or let users to choose the the file suffixes that they expect the extension to take effect. Checking if the current document text contains //==UserScript==
may cause a little bit performance loss, i think checking the file suffix is enough.
Checking if the current document text contains //==UserScript== may cause a little bit performance loss
My solution above only checks if one of the lines start with it, so it shouldn't matter much. And also it should be optional.
But most important is just some kind of way to control when it activates, since currently it pollutes any open js file
v0.0.7
has been published, check it out :)
However, syntax highlight still can't be controlled by extension settings due to the limitations of vscode, editing the package.json
or syntaxes/userjs.tmLanguage.json
file manually seems to be the only solution.
This is great! I can't even find the syntax highlighting you are talking of, so LGTM!
@andywang425 would still be cool to have an option so that the extension checks if the first written line starts with
// ==UserScript==
if (document.getText().trimStart().startsWith("// ==UserScript==")) {
return true;
}
would still be cool to have an option so that the extension checks if the first written line starts with // ==UserScript==
Just did some work in this commit. I planned to implement this feature in the next release.
I think by default, each provider should only activate if the current document filename ends with
.user.js
then there should be an extension option to activate if the current document text contains// ==UserScript==
Maybe each provider could call a function like this?
What do you think of this idea?