File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323} from 'vscode-languageclient/node' ;
2424
2525export let defaultClient : LuaClient | null ;
26+ let outputChannel : vscode . OutputChannel | undefined ;
2627
2728function registerCustomCommands ( context : ExtensionContext ) {
2829 context . subscriptions . push ( Commands . registerCommand ( 'lua.config' , ( changes ) => {
@@ -137,6 +138,11 @@ class LuaClient extends Disposable {
137138 }
138139
139140 async start ( ) {
141+ // 复用或创建输出通道
142+ if ( ! outputChannel ) {
143+ outputChannel = vscode . window . createOutputChannel ( "Lua" , { log : true } ) ;
144+ }
145+
140146 // Options to control the language client
141147 const clientOptions : LanguageClientOptions = {
142148 // Register the server for plain text documents
@@ -146,6 +152,7 @@ class LuaClient extends Disposable {
146152 isTrusted : true ,
147153 supportHtml : true ,
148154 } ,
155+ outputChannel : outputChannel ,
149156 initializationOptions : {
150157 changeConfiguration : true ,
151158 statusBar : true ,
@@ -446,6 +453,11 @@ export async function deactivate() {
446453 defaultClient . dispose ( ) ;
447454 defaultClient = null ;
448455 }
456+ // 清理输出通道
457+ if ( outputChannel ) {
458+ outputChannel . dispose ( ) ;
459+ outputChannel = undefined ;
460+ }
449461 return undefined ;
450462}
451463vscode . SyntaxTokenType . String
You can’t perform that action at this time.
0 commit comments