Skip to content

Commit

Permalink
v0.0.18 - support for different file encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
kirides committed Jun 7, 2022
1 parent 97d5669 commit bafd3fe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
23 changes: 18 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ia32"
],
"license": "MIT",
"version": "0.0.17",
"version": "0.0.18",
"engines": {
"vscode": ">=1.65.0"
},
Expand All @@ -28,9 +28,22 @@
"onLanguage:daedalus"
],
"contributes": {
"configurationDefaults": {
"[daedalus]": {
"files.encoding": "windows1252"
"configuration": {
"type": "object",
"title": "Language Server Configuration",
"properties": {
"daedalusLanguageServer.fileEncoding": {
"type": "string",
"default": "Windows-1252",
"enum": ["Windows-1250", "Windows-1251", "Windows-1252"],
"description": "The file encoding"
},
"daedalusLanguageServer.srcFileEncoding": {
"type": "string",
"default": "Windows-1252",
"enum": ["Windows-1250", "Windows-1251", "Windows-1252"],
"description": "The file encoding"
}
}
},
"languages": [
Expand Down Expand Up @@ -85,4 +98,4 @@
"glob": "7.2.0",
"vscode-languageclient": "7.0.0"
}
}
}
19 changes: 15 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@

import * as vscode from 'vscode';
import * as path from 'path';
import * as os from 'os';
import { ServerOptions, LanguageClient, LanguageClientOptions } from 'vscode-languageclient/lib/node/main'
import { Trace } from 'vscode-jsonrpc';

const LANGUAGE: string = "daedalus";

export function activate(context: vscode.ExtensionContext) {
let serverExe = path.join(context.extensionPath, 'languageserver', 'DaedalusLanguageServer.exe');
const platform = os.platform();

let serverExe = path.join(context.extensionPath, 'languageserver', 'DaedalusLanguageServer');
if (platform === 'win32') {
serverExe = path.join(context.extensionPath, 'languageserver', 'DaedalusLanguageServer.exe');
} else if (platform === 'darwin') {
serverExe = path.join(context.extensionPath, 'languageserver', 'DaedalusLanguageServer_darwin');
};

let serverOptions: ServerOptions = {
run: { command: serverExe },
debug: { command: serverExe }
run: { command: serverExe, args: ["-loglevel", "info"] },
debug: { command: serverExe, args: ["-loglevel", "debug"] }
}

// Options to control the language client
Expand All @@ -26,7 +34,10 @@ export function activate(context: vscode.ExtensionContext) {
{ language: LANGUAGE, },
{ pattern: '**/*.d', },
{ pattern: '**/*.D', }
]
],
synchronize: {
configurationSection: 'daedalusLanguageServer',
}
}

// Create the language client and start the client.
Expand Down

0 comments on commit bafd3fe

Please sign in to comment.