Skip to content

Commit 5cf32ed

Browse files
Remove old workspace collection (#33)
* Remove old workspace collection * fix unused import
1 parent 9e40f93 commit 5cf32ed

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-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: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ResultUpdate, ToolPreparator } from "./toolPreparator";
66
import {
77
LanguageClient,
88
LanguageClientOptions,
9-
StreamInfo
9+
StreamInfo,
1010
} from 'vscode-languageclient/node';
1111

1212
import { workspace } from 'vscode';
@@ -25,24 +25,18 @@ export class Ctx {
2525
private _extensionContext: vscode.ExtensionContext;
2626
private _commands: Record<string, CommandCallback>;
2727
private _config: Config;
28-
private _workspaceDiagnostic: vscode.DiagnosticCollection;
2928

3029
constructor(ctx: vscode.ExtensionContext) {
3130
this._client = null;
3231
this._extensionContext = ctx;
3332
this._commands = {};
3433
this._config = null;
35-
this._workspaceDiagnostic = vscode.languages.createDiagnosticCollection("4d_workspace");
3634
}
3735

3836
public get config(): Config {
3937
return this._config;
4038
}
4139

42-
public get workspaceDiagnostic(): vscode.DiagnosticCollection {
43-
return this._workspaceDiagnostic;
44-
}
45-
4640
public get extensionContext(): vscode.ExtensionContext {
4741
return this._extensionContext;
4842
}
@@ -213,22 +207,17 @@ export class Ctx {
213207
const clientOptions: LanguageClientOptions = {
214208
// Register the server for plain text documents
215209
documentSelector: [
216-
{ scheme: 'file', language: '4d' },
210+
{ scheme: 'file', language: '4d' },
217211
{ scheme: 'file', language: '4qs' }
218212
],
219213
synchronize: {
220214
// Notify the server about file changes to '.clientrc files contained in the workspace
221-
fileEvents: workspace.createFileSystemWatcher('**/.4DSettings')
215+
fileEvents: workspace.createFileSystemWatcher('**/.4DSettings'),
216+
// Configure textDocument sync options to include save notifications
217+
configurationSection: '4D-Analyzer'
222218
},
223219
initializationOptions: this._config.cfg,
224220
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-
}
232221
};
233222
// Create the language client and start the client.
234223
this._client = new LanguageClient(
@@ -243,6 +232,7 @@ export class Ctx {
243232

244233
public start() {
245234
this._config = new Config(this._extensionContext);
235+
246236
if (this._config.IsTool4DEnabled()) {
247237
this.prepareTool4D(this._config.tool4DWanted(), this._config.tool4DLocation(), this._config.tool4DDownloadChannel())
248238
.then(result => {

0 commit comments

Comments
 (0)