@@ -6,7 +6,8 @@ import { ResultUpdate, ToolPreparator } from "./toolPreparator";
66import {
77 LanguageClient ,
88 LanguageClientOptions ,
9- StreamInfo
9+ StreamInfo ,
10+ Diagnostic
1011} from 'vscode-languageclient/node' ;
1112
1213import { workspace } from 'vscode' ;
@@ -15,6 +16,7 @@ import * as net from 'net';
1516import { Logger } from "./logger" ;
1617import { existsSync , readdirSync , rmdirSync , rm } from "fs" ;
1718import * as path from "path" ;
19+ import { DiagnosticFeature } from 'vscode-languageclient/lib/common/diagnostic' ;
1820
1921export type CommandCallback = {
2022 call : ( ctx : Ctx ) => Commands . Cmd ;
@@ -25,24 +27,18 @@ export class Ctx {
2527 private _extensionContext : vscode . ExtensionContext ;
2628 private _commands : Record < string , CommandCallback > ;
2729 private _config : Config ;
28- private _workspaceDiagnostic : vscode . DiagnosticCollection ;
2930
3031 constructor ( ctx : vscode . ExtensionContext ) {
3132 this . _client = null ;
3233 this . _extensionContext = ctx ;
3334 this . _commands = { } ;
3435 this . _config = null ;
35- this . _workspaceDiagnostic = vscode . languages . createDiagnosticCollection ( "4d_workspace" ) ;
3636 }
3737
3838 public get config ( ) : Config {
3939 return this . _config ;
4040 }
4141
42- public get workspaceDiagnostic ( ) : vscode . DiagnosticCollection {
43- return this . _workspaceDiagnostic ;
44- }
45-
4642 public get extensionContext ( ) : vscode . ExtensionContext {
4743 return this . _extensionContext ;
4844 }
@@ -213,22 +209,17 @@ export class Ctx {
213209 const clientOptions : LanguageClientOptions = {
214210 // Register the server for plain text documents
215211 documentSelector : [
216- { scheme : 'file' , language : '4d' } ,
212+ { scheme : 'file' , language : '4d' } ,
217213 { scheme : 'file' , language : '4qs' }
218214 ] ,
219215 synchronize : {
220216 // Notify the server about file changes to '.clientrc files contained in the workspace
221- fileEvents : workspace . createFileSystemWatcher ( '**/.4DSettings' )
217+ fileEvents : workspace . createFileSystemWatcher ( '**/.4DSettings' ) ,
218+ // Configure textDocument sync options to include save notifications
219+ configurationSection : '4D-Analyzer'
222220 } ,
223221 initializationOptions : this . _config . cfg ,
224222 diagnosticCollectionName : "4d" ,
225- middleware : {
226- provideDiagnostics : ( document , previousResultId , token , next ) => {
227- if ( this . _config . diagnosticEnabled )
228- this . _workspaceDiagnostic . set ( document instanceof vscode . Uri ? document : document . uri , undefined ) ;
229- return next ( document , previousResultId , token ) ;
230- }
231- }
232223 } ;
233224 // Create the language client and start the client.
234225 this . _client = new LanguageClient (
@@ -243,6 +234,7 @@ export class Ctx {
243234
244235 public start ( ) {
245236 this . _config = new Config ( this . _extensionContext ) ;
237+
246238 if ( this . _config . IsTool4DEnabled ( ) ) {
247239 this . prepareTool4D ( this . _config . tool4DWanted ( ) , this . _config . tool4DLocation ( ) , this . _config . tool4DDownloadChannel ( ) )
248240 . then ( result => {
0 commit comments