Skip to content

Commit a1f8237

Browse files
Remove old workspace collection
1 parent 9e40f93 commit a1f8237

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

editor/src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function checkWorkspaceSyntax(ctx: Ctx): Cmd {
123123
);
124124

125125
const response = await client.sendRequest(ext.checkWorkspaceSyntax, params);
126-
const diagnosticCollection = ctx.workspaceDiagnostic;
126+
const diagnosticCollection = ctx.client.diagnostics;
127127
diagnosticCollection.clear();
128128
response.items.forEach(diagWorkspace => {
129129
const diagnostics: vscode.Diagnostic[] = [];

editor/src/ctx.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { ResultUpdate, ToolPreparator } from "./toolPreparator";
66
import {
77
LanguageClient,
88
LanguageClientOptions,
9-
StreamInfo
9+
StreamInfo,
10+
Diagnostic
1011
} from 'vscode-languageclient/node';
1112

1213
import { workspace } from 'vscode';
@@ -15,6 +16,7 @@ import * as net from 'net';
1516
import { Logger } from "./logger";
1617
import { existsSync, readdirSync, rmdirSync, rm } from "fs";
1718
import * as path from "path";
19+
import { DiagnosticFeature } from 'vscode-languageclient/lib/common/diagnostic';
1820

1921
export 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

Comments
 (0)