Skip to content

Commit

Permalink
Hover click supports double quoted paths
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Dec 7, 2024
1 parent ddec989 commit cf2589c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/language/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | undefined> {
Expand All @@ -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[] = []
Expand All @@ -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
}
Expand Down

0 comments on commit cf2589c

Please sign in to comment.