From cf2589c22024665d6bb978268a9f02f08d13aa57 Mon Sep 17 00:00:00 2001 From: James Yu Date: Sat, 7 Dec 2024 23:01:50 +0800 Subject: [PATCH] Hover click supports double quoted paths --- src/language/definition.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/language/definition.ts b/src/language/definition.ts index 360b3dcb8..70d3b2e05 100644 --- a/src/language/definition.ts +++ b/src/language/definition.ts @@ -4,6 +4,7 @@ import * as path from 'path' import { lw } from '../lw' import { tokenizer } from '../utils/tokenizer' import * as utils from '../utils/utils' +import { sanitizeInputFilePath } from '../utils/inputfilepath' export class DefinitionProvider implements vscode.DefinitionProvider { private async onAFilename(document: vscode.TextDocument, position: vscode.Position, token: string): Promise { @@ -18,7 +19,7 @@ export class DefinitionProvider implements vscode.DefinitionProvider { } if (line.match(regexDocumentclass)) { - return utils.resolveFile([path.dirname(vscode.window.activeTextEditor.document.fileName)], token, '.cls') + return utils.resolveFile([path.dirname(vscode.window.activeTextEditor.document.fileName)], sanitizeInputFilePath(token), '.cls') } let dirs: string[] = [] @@ -31,11 +32,11 @@ export class DefinitionProvider implements vscode.DefinitionProvider { const result = line.match(regexImport) if (result) { - dirs = [path.resolve(path.dirname(vscode.window.activeTextEditor.document.fileName), result[1])] + dirs = [path.resolve(path.dirname(vscode.window.activeTextEditor.document.fileName), sanitizeInputFilePath(result[1]))] } if (dirs.length > 0) { - return utils.resolveFile(dirs, token, '.tex') + return utils.resolveFile(dirs, sanitizeInputFilePath(token), '.tex') } return }