@@ -32,12 +32,18 @@ export function activate(context: vscode.ExtensionContext): void {
3232 // Cite
3333 commandRegistrar . register ( 'citeWeb' , addWebCiteFactory ) ;
3434
35- configureLuaLibrary ( "Scribunto" , true ) ;
35+ configureLuaLibrary (
36+ "Scribunto" ,
37+ vscode . workspace . getConfiguration ( "wikitext" ) . get < string > ( "scopedLuaIntegration" ) !== "disabled"
38+ ) ;
3639}
3740
3841export function deactivate ( ) : void {
3942 console . log ( "Extension is inactive." ) ;
40- configureLuaLibrary ( "Scribunto" , false ) ;
43+
44+ if ( vscode . workspace . getConfiguration ( "wikitext" ) . get < string > ( "scopedLuaIntegration" ) !== "enabled" ) {
45+ configureLuaLibrary ( "Scribunto" , false ) ;
46+ }
4147}
4248
4349export function configureLuaLibrary ( folder : string , enable : boolean ) {
@@ -47,7 +53,6 @@ export function configureLuaLibrary(folder: string, enable: boolean) {
4753 return ;
4854 }
4955
50- // Use path.join to ensure the proper path seperators are used.
5156 const folderPath = path . join ( extensionPath , "EmmyLua" , folder ) ;
5257 const config = vscode . workspace . getConfiguration ( "Lua" ) ;
5358 const library : string [ ] | undefined = config . get ( "workspace.library" ) ;
@@ -57,7 +62,7 @@ export function configureLuaLibrary(folder: string, enable: boolean) {
5762
5863 if ( library && extensionPath ) {
5964 // remove any older versions of our path
60- for ( let i = library . length - 1 ; i >= 0 ; i -- ) {
65+ for ( let i = library . length - 1 ; i >= 0 ; i -- ) {
6166 const item = library [ i ] ;
6267 const isSelfExtension = item . indexOf ( extensionId ) > - 1 ;
6368 const isCurrentVersion = item . indexOf ( extensionPath ) > - 1 ;
@@ -77,6 +82,6 @@ export function configureLuaLibrary(folder: string, enable: boolean) {
7782 library . splice ( index , 1 ) ;
7883 }
7984 }
80- config . update ( "workspace.library" , library , true ) ;
85+ config . update ( "workspace.library" , library , false ) ;
8186 }
8287}
0 commit comments