Adding signal mapping file

This commit is contained in:
brice.boisson
2025-10-23 23:08:17 +02:00
parent 8896c92d75
commit 1f689efbc3
4 changed files with 91 additions and 2 deletions

View File

@@ -1,8 +1,9 @@
import * as vscode from 'vscode';
import * as path from 'path';
import { waveMode, lastHoverByDoc, HOVER_FRESH_MS } from './extension';
import { waveMode, lastHoverByDoc, waveMappingEnable, HOVER_FRESH_MS } from './extension';
import { sendAndAwait } from './eda_connect';
import { globalMap } from './signal_mapping';
export let moduleTree: Record<string, { module: string[], last: number }> = {};
@@ -69,7 +70,7 @@ export async function addWave(
return;
}
const tokenText = editor.document.getText(wordRange);
let tokenText = editor.document.getText(wordRange);
const isVariable = await looksLikeVariable(editor, position);
if (!isVariable) {
const choice = await vscode.window.showWarningMessage(
@@ -80,6 +81,13 @@ export async function addWave(
if (choice !== 'Add') return;
}
if (waveMappingEnable) {
if (globalMap.has(tokenText)) {
tokenText = globalMap.get(tokenText)!; // "!" asserts it's not undefined
// do something with truc
}
}
// Load module tree once per session
if (Object.keys(moduleTree).length === 0) {
moduleTree = await requestModuleTree(sharedDir, topScope, timeoutMs);