Skip to content

Commit fb86231

Browse files
committed
ensure updated config is synced on use of restart command, and clean up a few unused things
1 parent a3f549d commit fb86231

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

client/src/extension.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function activate(context: ExtensionContext) {
9797
"ReScriptLSP",
9898
"ReScript Language Server",
9999
serverOptions,
100-
clientOptions
100+
createClientOptions()
101101
);
102102
attachCodeAnalysis(client);
103103
return client;
@@ -122,21 +122,20 @@ export function activate(context: ExtensionContext) {
122122
},
123123
};
124124

125-
// Options to control the language client
126-
let clientOptions: LanguageClientOptions = {
127-
// Register the server for plain text documents
128-
documentSelector: [{ scheme: "file", language: "rescript" }],
129-
synchronize: {
130-
// Notify the server about file changes to '.clientrc files contained in the workspace
131-
fileEvents: workspace.createFileSystemWatcher("**/.clientrc"),
132-
},
133-
// We'll send the initial configuration in here, but this might be
134-
// problematic because every consumer of the LS will need to mimic this.
135-
// We'll leave it like this for now, but might be worth revisiting later on.
136-
initializationOptions: {
137-
extensionConfiguration: workspace.getConfiguration("rescript.settings"),
138-
},
139-
};
125+
function createClientOptions() {
126+
// Options to control the language client
127+
let clientOptions: LanguageClientOptions = {
128+
documentSelector: [{ scheme: "file", language: "rescript" }],
129+
// We'll send the initial configuration in here, but this might be
130+
// problematic because every consumer of the LS will need to mimic this.
131+
// We'll leave it like this for now, but might be worth revisiting later on.
132+
initializationOptions: {
133+
extensionConfiguration: workspace.getConfiguration("rescript.settings"),
134+
},
135+
};
136+
137+
return clientOptions;
138+
}
140139

141140
// Create the language client and start the client.
142141
client = createLanguageClient();

0 commit comments

Comments
 (0)