Adding signal mapping file
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user