@@ -3,57 +3,57 @@ import getLuaPath from "./getPath";
33import getSettingsScope from "./getSettingsScope" ;
44
55export default async function setPlugin ( enable : boolean ) {
6- const config = getLuaConfig ( ) ;
7- const pluginPath = getLuaPath ( "plugin.lua" ) ;
8- const settingsScope = getSettingsScope ( ) ;
9-
10- if ( enable ) {
11- await config . update ( "runtime.version" , "Lua 5.4" , settingsScope ) ;
12- await config . update ( "runtime.plugin" , pluginPath , settingsScope ) ;
13-
14- // Support extra symbols in LuaParser
15- const nonstandardSymbol : string [ ] =
16- config . get ( "runtime.nonstandardSymbol" ) || [ ] ;
17- [
18- "/**/" ,
19- "`" ,
20- "+=" ,
21- "-=" ,
22- "*=" ,
23- "/=" ,
24- "<<=" ,
25- ">>=" ,
26- "&=" ,
27- "|=" ,
28- "^=" ,
29- ] . forEach ( ( item ) => {
30- if ( ! nonstandardSymbol . includes ( item ) ) {
31- nonstandardSymbol . push ( item ) ;
32- }
33- } ) ;
34-
35- await config . update (
36- "runtime.nonstandardSymbol" ,
37- nonstandardSymbol ,
38- settingsScope
39- ) ;
40-
41- // Disable diagnostics for files/directories (using .gitignore grammar)
42- // Drastically improves time to load workspace
43- const ignoreDir : string [ ] = config . get ( "workspace.ignoreDir" ) || [ ] ;
44-
45- [ ".vscode" , ".git" , ".github" , "node_modules" ] . forEach ( ( item ) => {
46- if ( ! ignoreDir . includes ( item ) ) {
47- ignoreDir . push ( item ) ;
48- }
49- } ) ;
50-
51- await config . update ( "workspace.ignoreDir" , ignoreDir , settingsScope ) ;
52-
53- return ;
54- }
55-
56- if ( config . get ( "runtime.plugin" ) === pluginPath ) {
57- await config . update ( "runtime.plugin" , undefined , settingsScope ) ;
58- }
6+ const config = getLuaConfig ( ) ;
7+ const pluginPath = getLuaPath ( "plugin.lua" ) ;
8+ const settingsScope = getSettingsScope ( ) ;
9+
10+ if ( enable ) {
11+ await config . update ( "runtime.version" , "Lua 5.4" , settingsScope ) ;
12+ await config . update ( "runtime.plugin" , pluginPath , settingsScope ) ;
13+
14+ // Support extra symbols in LuaParser
15+ const nonstandardSymbol : string [ ] =
16+ config . get ( "runtime.nonstandardSymbol" ) || [ ] ;
17+ [
18+ "/**/" ,
19+ "`" ,
20+ "+=" ,
21+ "-=" ,
22+ "*=" ,
23+ "/=" ,
24+ "<<=" ,
25+ ">>=" ,
26+ "&=" ,
27+ "|=" ,
28+ "^=" ,
29+ ] . forEach ( ( item ) => {
30+ if ( ! nonstandardSymbol . includes ( item ) ) {
31+ nonstandardSymbol . push ( item ) ;
32+ }
33+ } ) ;
34+
35+ await config . update (
36+ "runtime.nonstandardSymbol" ,
37+ nonstandardSymbol ,
38+ settingsScope ,
39+ ) ;
40+
41+ // Disable diagnostics for files/directories (using .gitignore grammar)
42+ // Drastically improves time to load workspace
43+ const ignoreDir : string [ ] = config . get ( "workspace.ignoreDir" ) || [ ] ;
44+
45+ [ ".vscode" , ".git" , ".github" , "node_modules" ] . forEach ( ( item ) => {
46+ if ( ! ignoreDir . includes ( item ) ) {
47+ ignoreDir . push ( item ) ;
48+ }
49+ } ) ;
50+
51+ await config . update ( "workspace.ignoreDir" , ignoreDir , settingsScope ) ;
52+
53+ return ;
54+ }
55+
56+ if ( config . get ( "runtime.plugin" ) === pluginPath ) {
57+ await config . update ( "runtime.plugin" , undefined , settingsScope ) ;
58+ }
5959}
0 commit comments