Skip to content

Commit e1ec27f

Browse files
authored
fix(vscode): scope profiling server config (#114)
2 parents a90aea5 + 803aff1 commit e1ec27f

2 files changed

Lines changed: 26 additions & 40 deletions

File tree

editors/vscode/src/profiling.ts

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as path from 'node:path';
55
import * as vscode from 'vscode';
66

77
import { stripProfileArgs } from './profilingArgs';
8+
import { diagnosticsProfilingInitializationOptions } from './profilingConfig';
89
import {
910
type DiagnosticProfileRequest,
1011
diagnosticsFromProfileResponse,
@@ -309,7 +310,7 @@ function createProfileSession(
309310
stdio: 'pipe',
310311
});
311312

312-
return new LspProfileSession(child, channel, readVizslaInitializationOptions);
313+
return new LspProfileSession(child, channel, readDiagnosticsProfilingInitializationOptions);
313314
}
314315

315316
async function stopProfileSession(
@@ -349,45 +350,8 @@ async function showProfileCompleteMessage(
349350
}
350351
}
351352

352-
function readVizslaInitializationOptions(): Record<string, unknown> {
353-
const config = vscode.workspace.getConfiguration('vizsla');
354-
return {
355-
files_excludeDirs: config.get('files.excludeDirs') ?? [],
356-
files_watcher: config.get('files.watcher') ?? 'client',
357-
workspace_auto_reload: config.get('workspace.auto.reload') ?? true,
358-
scope_visibility: config.get('scope.visibility') ?? 'private',
359-
formatter_provider: config.get('formatter.provider') ?? 'verible',
360-
formatter_path: config.get('formatter.path') ?? null,
361-
formatter_args: config.get('formatter.args') ?? ['--failsafe_success=false'],
362-
formatting_on_enter: config.get('formatting.on.enter') ?? true,
363-
formatting_in_comments: config.get('formatting.in.comments') ?? true,
364-
formatting_indent_width: config.get('formatting.indent.width') ?? 4,
365-
inlayHints_port_connection_enable: config.get('inlayHints.port.connection.enable') ?? true,
366-
inlayHints_parameter_assignment_enable:
367-
config.get('inlayHints.parameter.assignment.enable') ?? true,
368-
inlayHints_end_structure_enable: config.get('inlayHints.end.structure.enable') ?? true,
369-
lens_instantiations_enable: config.get('lens.instantiations.enable') ?? true,
370-
semantic_tokens_port_clk_rst_enable:
371-
config.get('semantic.tokens.port.clk.rst.enable') ?? true,
372-
semantic_tokens_port_input_output_enable:
373-
config.get('semantic.tokens.port.input.output.enable') ?? true,
374-
diagnostics: {
375-
enable: config.get('diagnostics.enable') ?? true,
376-
update: config.get('diagnostics.update') ?? 'onSave',
377-
parse: { enable: config.get('diagnostics.parse.enable') ?? true },
378-
semantic: { enable: config.get('diagnostics.semantic.enable') ?? true },
379-
slang: {
380-
warnings: config.get('diagnostics.slang.warnings') ?? [],
381-
rules: config.get('diagnostics.slang.rules') ?? [],
382-
},
383-
},
384-
signature_help_params_only: config.get('signature.help.params.only') ?? false,
385-
qihe_command: config.get('qihe.command') ?? 'qihe',
386-
qihe_autoConfigureArgsFromManifest:
387-
config.get('qihe.autoConfigureArgsFromManifest') ?? true,
388-
qihe_compileArgs: config.get('qihe.compileArgs') ?? [],
389-
qihe_runArgs: config.get('qihe.runArgs') ?? ['-g', 'std'],
390-
};
353+
function readDiagnosticsProfilingInitializationOptions(): Record<string, unknown> {
354+
return diagnosticsProfilingInitializationOptions(vscode.workspace.getConfiguration('vizsla'));
391355
}
392356

393357
async function writeJsonFile(filePath: string, value: unknown): Promise<void> {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
type ConfigurationReader = {
2+
get<T>(section: string): T | undefined;
3+
};
4+
5+
export function diagnosticsProfilingInitializationOptions(
6+
config: ConfigurationReader,
7+
): Record<string, unknown> {
8+
return {
9+
files_excludeDirs: config.get('files.excludeDirs') ?? [],
10+
// The profiling runner does not implement client-side file watching.
11+
files_watcher: 'server',
12+
diagnostics: {
13+
enable: config.get('diagnostics.enable') ?? true,
14+
parse: { enable: config.get('diagnostics.parse.enable') ?? true },
15+
semantic: { enable: config.get('diagnostics.semantic.enable') ?? true },
16+
slang: {
17+
warnings: config.get('diagnostics.slang.warnings') ?? [],
18+
rules: config.get('diagnostics.slang.rules') ?? [],
19+
},
20+
},
21+
};
22+
}

0 commit comments

Comments
 (0)