Skip to content

Commit

Permalink
refactor: use URIs instead of path in dialectAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
VitGottwald committed Apr 13, 2023
1 parent c8dd773 commit afdf058
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions clients/cobol-lsp-vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function deactivate() {

function getDialectAPI_v_1_0() {
return {
//name: extensionId: string, string, path: string, description: string, snippetPath: string
//name: extensionId: string, string, jar: string, description: string, snippets: string
registerDialect(dialect) {
outputChannel.appendLine(
"Register new dialect: \r\n" + JSON.stringify(dialect),
Expand All @@ -143,9 +143,9 @@ function getDialectAPI_v_1_0() {
DialectRegistry.register(
dialect.extensionId,
dialect.name,
dialect.path,
dialect.jar.path,
dialect.description,
dialect.snippetPath,
dialect.snippets.path,
);
outputChannel.appendLine("Restart analysis");
languageClientService.invalidateConfiguration();
Expand Down
13 changes: 6 additions & 7 deletions clients/idms-dialect-support/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
import * as vscode from "vscode";

const mainExtension = "BroadcomMFD.cobol-language-support";
const dialectName = "IDMS";

let unregisterDialect: () => void;

export async function activate(context: vscode.ExtensionContext) {
const extensionId = context.extension.id;
const extensionUri = context.extensionUri;
const jarFolderUri = vscode.Uri.joinPath(
const snippets = vscode.Uri.joinPath(extensionUri, "snippets.json");
const jar = vscode.Uri.joinPath(
extensionUri,
"server",
"jar",
/* TODO: "dialect-jar.jar" */
);
const snippetPathUri = vscode.Uri.joinPath(extensionUri, "snippets.json");

const main = vscode.extensions.getExtension(mainExtension);
if (main === undefined) {
Expand All @@ -29,11 +28,11 @@ export async function activate(context: vscode.ExtensionContext) {
}

unregisterDialect = mainApi.dialectAPI_1_0().registerDialect({
extensionId: extensionId,
name: dialectName,
path: jarFolderUri.path,
name: "IDMS",
description: "IDMS dialect support",
snippetPath: snippetPathUri.path,
jar: jar,
snippets: snippets,
extensionId: extensionId,
});
}

Expand Down

0 comments on commit afdf058

Please sign in to comment.