firefly-compiler 0.6.24 → 0.6.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -12,12 +12,28 @@ import {
|
|
|
12
12
|
let client: LanguageClient;
|
|
13
13
|
|
|
14
14
|
export function activate(context: vscode.ExtensionContext) {
|
|
15
|
+
const packagedFireflyPath = path.join(context.extensionPath, 'firefly');
|
|
16
|
+
const devFireflyPath = path.resolve(context.extensionPath, '..');
|
|
17
|
+
const preferredPaths = context.extensionMode === vscode.ExtensionMode.Production
|
|
18
|
+
? [packagedFireflyPath, devFireflyPath]
|
|
19
|
+
: [devFireflyPath, packagedFireflyPath];
|
|
20
|
+
const fireflyPath = preferredPaths.find(candidate =>
|
|
21
|
+
fs.existsSync(path.join(candidate, 'output', 'js', 'ff', 'compiler', 'Main.run.mjs'))
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
if(!fireflyPath) {
|
|
25
|
+
throw new Error("Unable to locate Firefly installation in any candidate path: " + preferredPaths.join(", "));
|
|
26
|
+
}
|
|
15
27
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
const fireflyCompiler = path.join(fireflyPath, 'output', 'js', 'ff', 'compiler', 'Main.run.mjs');
|
|
29
|
+
const lspWorkingDirectory = path.join(fireflyPath, 'lsp');
|
|
30
|
+
|
|
31
|
+
if(!fs.existsSync(fireflyCompiler)) {
|
|
32
|
+
throw new Error("Unable to locate Firefly compiler at " + fireflyCompiler);
|
|
33
|
+
}
|
|
34
|
+
if(!fs.existsSync(lspWorkingDirectory)) {
|
|
35
|
+
throw new Error("Unable to locate LSP working directory at " + lspWorkingDirectory);
|
|
36
|
+
}
|
|
21
37
|
|
|
22
38
|
context.subscriptions.push(vscode.commands.registerCommand('extension.firefly-lang.getFireflyPath', config => {
|
|
23
39
|
return fireflyPath;
|
|
@@ -58,7 +74,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
58
74
|
const runOrDebug = {
|
|
59
75
|
module: fireflyCompiler,
|
|
60
76
|
args: ['LanguageServer.ff'],
|
|
61
|
-
options: {cwd:
|
|
77
|
+
options: {cwd: lspWorkingDirectory},
|
|
62
78
|
transport: TransportKind.stdio // ipc
|
|
63
79
|
};
|
|
64
80
|
|