mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +00:00 
			
		
		
		
	Always reload onEnter configuration
Configuration reload doesn't happen often anyway, and there will always be a set of onEnter rules to load
This commit is contained in:
		
							parent
							
								
									992bafa773
								
							
						
					
					
						commit
						c7bd3c682f
					
				@ -11,9 +11,7 @@ export type RunnableEnvCfg =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export class Config {
 | 
					export class Config {
 | 
				
			||||||
    readonly extensionId = "rust-lang.rust-analyzer";
 | 
					    readonly extensionId = "rust-lang.rust-analyzer";
 | 
				
			||||||
    configureLang:
 | 
					    configureLang: vscode.Disposable | undefined;
 | 
				
			||||||
        | { handle: vscode.Disposable; typingContinueCommentsOnNewline: boolean }
 | 
					 | 
				
			||||||
        | undefined;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    readonly rootSection = "rust-analyzer";
 | 
					    readonly rootSection = "rust-analyzer";
 | 
				
			||||||
    private readonly requiresReloadOpts = [
 | 
					    private readonly requiresReloadOpts = [
 | 
				
			||||||
@ -45,7 +43,7 @@ export class Config {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dispose() {
 | 
					    dispose() {
 | 
				
			||||||
        this.configureLang?.handle.dispose();
 | 
					        this.configureLang?.dispose();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private refreshLogging() {
 | 
					    private refreshLogging() {
 | 
				
			||||||
@ -89,12 +87,8 @@ export class Config {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private configureLanguage() {
 | 
					    private configureLanguage() {
 | 
				
			||||||
        // Only need to dispose of the config if there's a change
 | 
					        // Only need to dispose of the config if there's a change
 | 
				
			||||||
        if (
 | 
					        if (this.configureLang) {
 | 
				
			||||||
            this.configureLang &&
 | 
					            this.configureLang.dispose();
 | 
				
			||||||
            this.typingContinueCommentsOnNewline !==
 | 
					 | 
				
			||||||
                this.configureLang.typingContinueCommentsOnNewline
 | 
					 | 
				
			||||||
        ) {
 | 
					 | 
				
			||||||
            this.configureLang.handle.dispose();
 | 
					 | 
				
			||||||
            this.configureLang = undefined;
 | 
					            this.configureLang = undefined;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -167,12 +161,9 @@ export class Config {
 | 
				
			|||||||
            ];
 | 
					            ];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.configureLang = {
 | 
					        this.configureLang = vscode.languages.setLanguageConfiguration("rust", {
 | 
				
			||||||
            handle: vscode.languages.setLanguageConfiguration("rust", {
 | 
					 | 
				
			||||||
            onEnterRules,
 | 
					            onEnterRules,
 | 
				
			||||||
            }),
 | 
					        });
 | 
				
			||||||
            typingContinueCommentsOnNewline: this.typingContinueCommentsOnNewline,
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // We don't do runtime config validation here for simplicity. More on stackoverflow:
 | 
					    // We don't do runtime config validation here for simplicity. More on stackoverflow:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user