Skip to content

Commit

Permalink
Add setting for workspace root modules
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschright committed Jun 26, 2020
1 parent e3bcbd8 commit 4b88f26
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
26 changes: 17 additions & 9 deletions out/extension.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion out/extension.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 17 additions & 9 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,16 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.workspace.onDidChangeConfiguration(
(event: vscode.ConfigurationChangeEvent) => {
if (!event.affectsConfiguration('terraform.languageServer')) {
if (event.affectsConfiguration("terraform")) {
const reloadMsg = "Reload VSCode window to apply language server changes";
vscode.window.showInformationMessage(reloadMsg, "Reload").then((selected) => {
if (selected === "Reload") {
vscode.commands.executeCommand("workbench.action.reloadWindow");
}
});
} else {
return;
}
const reloadMsg = 'Reload VSCode window to apply language server changes';
vscode.window.showInformationMessage(reloadMsg, 'Reload').then((selected) => {
if (selected === 'Reload') {
vscode.commands.executeCommand('workbench.action.reloadWindow');
}
});
}
)
);
Expand Down Expand Up @@ -104,13 +105,20 @@ async function startLsClient(cmd: string, config: vscode.WorkspaceConfiguration)
const binaryName = cmd.split("/").pop();
let serverOptions: ServerOptions;
let serverArgs: string[] = config.get("languageServer.args");
let additionalArgs: string[];

if (config.has("rootModules")) {
const rootModules: string[] = config.get("rootModules");
additionalArgs = rootModules.map(module => `-root-module=${module}`);
}
const args = serverArgs.concat(additionalArgs);

const setup = vscode.window.createOutputChannel(binaryName);
setup.appendLine(`Launching language server: ${cmd} ${serverArgs}`)
setup.appendLine(`Launching language server: ${cmd} ${args.join(" ")}`);

const executable: Executable = {
command: cmd,
args: serverArgs,
args: args,
options: {}
}
serverOptions = {
Expand Down

0 comments on commit 4b88f26

Please sign in to comment.