mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-23 00:22:56 +01:00
fix: support go to definition for extraLib file
This commit is contained in:
parent
e7d5b97033
commit
e0c11b34f5
1 changed files with 13 additions and 1 deletions
|
|
@ -7,7 +7,8 @@
|
||||||
import {
|
import {
|
||||||
Diagnostic,
|
Diagnostic,
|
||||||
DiagnosticRelatedInformation,
|
DiagnosticRelatedInformation,
|
||||||
LanguageServiceDefaults
|
LanguageServiceDefaults,
|
||||||
|
typescriptDefaults
|
||||||
} from './monaco.contribution';
|
} from './monaco.contribution';
|
||||||
import type * as ts from './lib/typescriptServices';
|
import type * as ts from './lib/typescriptServices';
|
||||||
import type { TypeScriptWorker } from './tsWorker';
|
import type { TypeScriptWorker } from './tsWorker';
|
||||||
|
|
@ -789,6 +790,17 @@ export class DefinitionAdapter extends Adapter {
|
||||||
uri: uri,
|
uri: uri,
|
||||||
range: this._textSpanToRange(refModel, entry.textSpan)
|
range: this._textSpanToRange(refModel, entry.textSpan)
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
const matchedLibFile = typescriptDefaults.getExtraLibs()[entry.fileName]
|
||||||
|
if (matchedLibFile) {
|
||||||
|
const libModel = editor.createModel(matchedLibFile.content, 'typescript', uri);
|
||||||
|
return {
|
||||||
|
uri: uri,
|
||||||
|
range: this._textSpanToRange(libModel, entry.textSpan)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue