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
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly compiler",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.6.24",
7
+ "version": "0.6.27",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -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 fireflyPath = fs.existsSync(path.join(context.extensionPath, '.vsixmanifest'))
17
- ? path.join(context.extensionPath, 'firefly')
18
- : path.join(context.extensionPath, '..')
19
-
20
- const fireflyCompiler = fireflyPath + '/output/js/ff/compiler/Main.run.mjs';
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: fireflyPath + '/lsp'},
77
+ options: {cwd: lspWorkingDirectory},
62
78
  transport: TransportKind.stdio // ipc
63
79
  };
64
80
 
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly language support",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.6.24",
7
+ "version": "0.6.27",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"