不用每个文件都查找一次i18n,提升性能
This commit is contained in:
parent
7a03e88943
commit
09fe290ad2
|
|
@ -23,17 +23,21 @@ class LocaleDocumentLinkProvider implements vscode.DocumentLinkProvider {
|
|||
const tCallRegex = /(?<![a-zA-Z])t\(['"`]([^'"`]*)['"`]\)/g;
|
||||
const documentLinks: vscode.DocumentLink[] = [];
|
||||
const diagnostics: vscode.Diagnostic[] = [];
|
||||
let match;
|
||||
|
||||
if (isLoadingLocale()) {
|
||||
await waitUntilLocaleLoaded();
|
||||
}
|
||||
|
||||
const match = tCallRegex.exec(text);
|
||||
if (!match) {
|
||||
return [];
|
||||
}
|
||||
getLocalesData(join(document.uri.fsPath, '../locales'));
|
||||
while ((match = tCallRegex.exec(text)) !== null) {
|
||||
while (match !== null) {
|
||||
const key = match[1];
|
||||
|
||||
if (key.includes('${')) {
|
||||
// 忽略动态key
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue