22// Import the module and reference it with the alias vscode in your code below
33import * as vscode from "vscode" ;
44import { setupStatusBar } from "./statusbar/status" ;
5- import { evalEditor } from "./commands/evalEditor" ;
65import { registerAllCommands } from "./commands" ;
76import { activateLspClient , deactivateLspClient } from "./lsp/client" ;
87import { LanguageClient } from "vscode-languageclient/node" ;
8+ import { canonicaliseLocation } from "./utils/misc" ;
9+ import config from "./utils/config" ;
910
1011// TODO: Don't expose this object directly, create an interface via a wrapper class
1112export let client : LanguageClient ;
@@ -25,6 +26,21 @@ export function activate(context: vscode.ExtensionContext) {
2526 const info = context . globalState . get ( "info" ) ?? { } ;
2627
2728 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+ }
2844}
2945
3046// This method is called when your extension is deactivated
0 commit comments