2
2
// Import the module and reference it with the alias vscode in your code below
3
3
import * as vscode from "vscode" ;
4
4
import { setupStatusBar } from "./statusbar/status" ;
5
- import { evalEditor } from "./commands/evalEditor" ;
6
5
import { registerAllCommands } from "./commands" ;
7
6
import { activateLspClient , deactivateLspClient } from "./lsp/client" ;
8
7
import { LanguageClient } from "vscode-languageclient/node" ;
8
+ import { canonicaliseLocation } from "./utils/misc" ;
9
+ import config from "./utils/config" ;
9
10
10
11
// TODO: Don't expose this object directly, create an interface via a wrapper class
11
12
export let client : LanguageClient ;
@@ -25,6 +26,21 @@ export function activate(context: vscode.ExtensionContext) {
25
26
const info = context . globalState . get ( "info" ) ?? { } ;
26
27
27
28
client . sendRequest ( "source/publishInfo" , info ) ;
29
+
30
+ // TODO: Prompt the user to make this folder the default, and then set back to the config store.
31
+
32
+ // Update user's workspace settings to associate .js to Source
33
+ const workspaceFolder = canonicaliseLocation ( config . workspaceFolder ) ;
34
+ if (
35
+ vscode . workspace . workspaceFolders
36
+ ?. map ( ( wf ) => wf . uri . fsPath )
37
+ . includes ( workspaceFolder )
38
+ ) {
39
+ const workspaceConfig = vscode . workspace . getConfiguration ( ) ;
40
+ workspaceConfig . update ( "files.associations" , {
41
+ "*.js" : "source" ,
42
+ } ) ;
43
+ }
28
44
}
29
45
30
46
// This method is called when your extension is deactivated
0 commit comments