-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: [DaCo] use cobol-dialect-api package
this required unifing the version of @types/vscode and typescript so that the code would compile
- Loading branch information
1 parent
4c73176
commit a1913a1
Showing
7 changed files
with
87 additions
and
70 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,29 @@ | ||
// The module 'vscode' contains the VS Code extensibility API | ||
// Import the module and reference it with the alias vscode in your code below | ||
import { join } from "path"; | ||
import * as vscode from "vscode"; | ||
import { registerDialect } from "@code4z/cobol-dialect-api"; | ||
|
||
const extensionId: string = "DaCo.daco-dialect-for-cobol"; | ||
const mainExtension: string = "BroadcomMFD.cobol-language-support"; | ||
|
||
let mainApi: any = undefined; | ||
let unregisterDialect: () => void; | ||
|
||
export async function activate(context: vscode.ExtensionContext) { | ||
const ext = vscode.extensions.getExtension(extensionId); | ||
if (ext === undefined) { | ||
throw new Error("Cannot find extension"); | ||
} | ||
|
||
const main = vscode.extensions.getExtension(mainExtension); | ||
if (main === undefined) { | ||
throw new Error("Cannot find COBOL LS extension"); | ||
} | ||
|
||
mainApi = await main.activate(); | ||
if (mainApi === undefined) { | ||
throw new Error("COBOL LS API is invalid"); | ||
} | ||
|
||
const executablePath = join(ext.extensionPath, "server", "jar"); | ||
const snippetPath = join(ext.extensionPath, "snippets.json"); | ||
|
||
mainApi.dialectAPI_1_0().registerDialect({ | ||
extensionId: extensionId, | ||
const extensionId = context.extension.id; | ||
const extensionUri = context.extensionUri; | ||
const snippets = vscode.Uri.joinPath(extensionUri, "snippets.json"); | ||
const jar = vscode.Uri.joinPath( | ||
extensionUri, | ||
"server", | ||
"jar", | ||
/* TODO: "dialect-daco.jar" */ | ||
); | ||
unregisterDialect = await registerDialect(extensionId, { | ||
apiVersion: 1, | ||
name: "DaCo", | ||
path: executablePath, | ||
description: "DaCo dialect support", | ||
snippetPath: snippetPath, | ||
snippets, | ||
jar, | ||
}); | ||
} | ||
|
||
export async function deactivate() { | ||
if (mainApi !== undefined) { | ||
mainApi.dialectAPI_1_0().unregister(extensionId, "DaCo"); | ||
} | ||
export function deactivate() { | ||
unregisterDialect(); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters