Skip to content

Commit 90cd758

Browse files
4qs compatible
1 parent 203e307 commit 90cd758

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

editor/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@
3636
],
3737
"configuration": "./language-configuration.json"
3838
},
39+
{
40+
"id": "4qs",
41+
"aliases": [
42+
"4QS",
43+
"4qs"
44+
],
45+
"extensions": [
46+
".4qs"
47+
],
48+
"configuration": "./language-configuration.json"
49+
},
3950
{
4051
"id": "json",
4152
"aliases": [

editor/src/ctx.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { workspace } from 'vscode';
1313
import * as child_process from 'child_process';
1414
import * as net from 'net';
15-
import {Logger} from "./logger";
15+
import { Logger } from "./logger";
1616
import { existsSync, mkdirSync, readdirSync, rmdirSync, rm } from "fs";
1717
import path = require('path');
1818

@@ -25,7 +25,7 @@ export class Ctx {
2525
private _extensionContext: vscode.ExtensionContext;
2626
private _commands: Record<string, CommandCallback>;
2727
private _config: Config;
28-
private _workspaceDiagnostic : vscode.DiagnosticCollection;
28+
private _workspaceDiagnostic: vscode.DiagnosticCollection;
2929

3030
constructor(ctx: vscode.ExtensionContext) {
3131
this._client = null;
@@ -83,7 +83,7 @@ export class Ctx {
8383
}
8484

8585

86-
public async prepareTool4D(inVersion: string, inLocation: string, inChannel : string): Promise<ResultUpdate> {
86+
public async prepareTool4D(inVersion: string, inLocation: string, inChannel: string): Promise<ResultUpdate> {
8787
const toolPreparator: ToolPreparator = new ToolPreparator(inVersion, inChannel, this._config.tool4dAPIKEY());
8888
const outLocation = !inLocation ? this.extensionContext.globalStorageUri.fsPath : inLocation;
8989
return toolPreparator.prepareTool4D(outLocation);
@@ -100,29 +100,27 @@ export class Ctx {
100100
}
101101

102102
const location = path.join(!this._config.tool4DLocation() ? this.extensionContext.globalStorageUri.fsPath : this._config.tool4DLocation(), "tool4d");
103-
if(!this._config.serverPath) //no path are ready
103+
if (!this._config.serverPath) //no path are ready
104104
{
105105
rmdirSync(location);
106106
}
107-
else
108-
{
107+
else {
109108
const labeledVersion = this.get4DVersion();
110109

111110
const labeledVersionWithoutChangelist = labeledVersion.clone();
112111
labeledVersionWithoutChangelist.changelist = 0;
113112
const directories = getDirectories(location);
114-
directories.forEach(async directory=> {
113+
directories.forEach(async directory => {
115114
const currentLabeledFolder = LabeledVersion.fromString(directory);
116115

117-
if(currentLabeledFolder.compare(labeledVersionWithoutChangelist) != 0){
118-
await rm(path.join(location, directory),{recursive:true}, ()=>{});
116+
if (currentLabeledFolder.compare(labeledVersionWithoutChangelist) != 0) {
117+
await rm(path.join(location, directory), { recursive: true }, () => { });
119118
}
120-
else
121-
{
119+
else {
122120
const directoriesChangelist = getDirectories(path.join(location, directory));
123121
directoriesChangelist.forEach(async dir => {
124-
if(Number(dir)!= labeledVersion.changelist){
125-
await rm(path.join(location, directory, dir),{recursive:true}, ()=>{});
122+
if (Number(dir) != labeledVersion.changelist) {
123+
await rm(path.join(location, directory, dir), { recursive: true }, () => { });
126124
}
127125
});
128126
}
@@ -214,7 +212,10 @@ export class Ctx {
214212
// Options to control the language client
215213
const clientOptions: LanguageClientOptions = {
216214
// Register the server for plain text documents
217-
documentSelector: [{ scheme: 'file', language: '4d' }],
215+
documentSelector: [
216+
{ scheme: 'file', language: '4d' },
217+
{ scheme: 'file', language: '4qs' }
218+
],
218219
synchronize: {
219220
// Notify the server about file changes to '.clientrc files contained in the workspace
220221
fileEvents: workspace.createFileSystemWatcher('**/.4DSettings')
@@ -223,7 +224,7 @@ export class Ctx {
223224
diagnosticCollectionName: "4d",
224225
middleware: {
225226
provideDiagnostics: (document, previousResultId, token, next) => {
226-
if(this._config.diagnosticEnabled)
227+
if (this._config.diagnosticEnabled)
227228
this._workspaceDiagnostic.set(document instanceof vscode.Uri ? document : document.uri, undefined);
228229
return next(document, previousResultId, token);
229230
}
@@ -250,7 +251,7 @@ export class Ctx {
250251
this._config.setTool4DPath(result.path);
251252
this._launch4D();
252253
})
253-
.catch((error : Error) => {
254+
.catch((error: Error) => {
254255
const userResponse = vscode.window.showErrorMessage(
255256
error.message
256257
);
@@ -262,7 +263,7 @@ export class Ctx {
262263
}
263264

264265
public registerCommands() {
265-
266+
266267
this._commands = {
267268
filesStatus: { call: Commands.filesStatus },
268269
updateTool4D: { call: Commands.updateTool4D },
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "4QS",
4+
"scopeName": "source.4qs"
5+
}

0 commit comments

Comments
 (0)