@codingame/monaco-vscode-treesitter-service-override 17.2.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -12
- package/package.json +4 -5
- package/vscode/src/vs/amdX.d.ts +3 -0
- package/vscode/src/vs/amdX.js +188 -0
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterLibraryService.d.ts +28 -0
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterLibraryService.js +136 -0
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterThemeService.d.ts +11 -0
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterThemeService.js +26 -0
- package/vscode/src/vs/editor/common/model/tokenStore.d.ts +0 -65
- package/vscode/src/vs/editor/common/model/tokenStore.js +0 -412
- package/vscode/src/vs/editor/common/model/treeSitterTokenStoreService.d.ts +0 -32
- package/vscode/src/vs/editor/common/model/treeSitterTokenStoreService.js +0 -135
- package/vscode/src/vs/editor/common/services/treeSitter/cursorUtils.d.ts +0 -6
- package/vscode/src/vs/editor/common/services/treeSitter/cursorUtils.js +0 -76
- package/vscode/src/vs/editor/common/services/treeSitter/textModelTreeSitter.d.ts +0 -88
- package/vscode/src/vs/editor/common/services/treeSitter/textModelTreeSitter.js +0 -684
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterLanguages.d.ts +0 -31
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterLanguages.js +0 -120
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterParserService.d.ts +0 -48
- package/vscode/src/vs/editor/common/services/treeSitter/treeSitterParserService.js +0 -179
- package/vscode/src/vs/editor/common/services/treeSitterParserService.d.ts +0 -61
- package/vscode/src/vs/editor/common/services/treeSitterParserService.js +0 -36
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterCodeEditors.d.ts +0 -32
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterCodeEditors.js +0 -119
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.contribution.d.ts +0 -1
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.contribution.js +0 -54
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.d.ts +0 -96
- package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.js +0 -719
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
4
|
-
import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
5
|
-
import '../../../../editor/common/services/treeSitter/treeSitterParserService.js';
|
|
6
|
-
import { ITreeSitterParserService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/treeSitterParserService.service';
|
|
7
|
-
import { ITreeSitterTokenizationFeature } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.service';
|
|
8
|
-
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
9
|
-
import { TreeSitterTokenizationRegistry } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
10
|
-
import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
11
|
-
import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
|
|
12
|
-
|
|
13
|
-
let TreeSitterTokenizationInstantiator = class TreeSitterTokenizationInstantiator {
|
|
14
|
-
static { this.ID = 'workbench.contrib.treeSitterTokenizationInstantiator'; }
|
|
15
|
-
constructor(_treeSitterTokenizationService, _treeSitterTokenizationFeature) { }
|
|
16
|
-
};
|
|
17
|
-
TreeSitterTokenizationInstantiator = ( __decorate([
|
|
18
|
-
( __param(0, ITreeSitterParserService)),
|
|
19
|
-
( __param(1, ITreeSitterTokenizationFeature))
|
|
20
|
-
], TreeSitterTokenizationInstantiator));
|
|
21
|
-
registerWorkbenchContribution2(TreeSitterTokenizationInstantiator.ID, TreeSitterTokenizationInstantiator, WorkbenchPhase.BlockRestore);
|
|
22
|
-
CommandsRegistry.registerCommand('_workbench.colorizeTreeSitterTokens', async (accessor, resource) => {
|
|
23
|
-
const treeSitterParserService = accessor.get(ITreeSitterParserService);
|
|
24
|
-
const textModelService = accessor.get(ITextFileService);
|
|
25
|
-
const textModel = resource ? (await textModelService.files.resolve(resource)).textEditorModel : undefined;
|
|
26
|
-
if (!textModel) {
|
|
27
|
-
throw ( new Error(`Cannot resolve text model for resource ${resource}`));
|
|
28
|
-
}
|
|
29
|
-
const tokenizer = await TreeSitterTokenizationRegistry.getOrCreate(textModel.getLanguageId());
|
|
30
|
-
if (!tokenizer) {
|
|
31
|
-
throw ( new Error(`Cannot resolve tokenizer for language ${textModel.getLanguageId()}`));
|
|
32
|
-
}
|
|
33
|
-
const textModelTreeSitter = await treeSitterParserService.getTextModelTreeSitter(textModel);
|
|
34
|
-
if (!textModelTreeSitter) {
|
|
35
|
-
throw ( new Error(
|
|
36
|
-
`Cannot resolve tree sitter parser for language ${textModel.getLanguageId()}`
|
|
37
|
-
));
|
|
38
|
-
}
|
|
39
|
-
const stopwatch = ( new StopWatch());
|
|
40
|
-
await textModelTreeSitter.parse();
|
|
41
|
-
stopwatch.stop();
|
|
42
|
-
let captureTime = 0;
|
|
43
|
-
let metadataTime = 0;
|
|
44
|
-
for (let i = 1; i <= textModel.getLineCount(); i++) {
|
|
45
|
-
const result = tokenizer.tokenizeEncodedInstrumented(i, textModel);
|
|
46
|
-
if (result) {
|
|
47
|
-
captureTime += result.captureTime;
|
|
48
|
-
metadataTime += result.metadataTime;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
textModelTreeSitter.dispose();
|
|
52
|
-
textModel.dispose();
|
|
53
|
-
return { parseTime: stopwatch.elapsed(), captureTime, metadataTime };
|
|
54
|
-
});
|
package/vscode/src/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type * as Parser from "@vscode/tree-sitter-wasm";
|
|
2
|
-
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
3
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
4
|
-
import { ILanguageIdCodec, ITreeSitterTokenizationSupport, QueryCapture } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
|
|
5
|
-
import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
6
|
-
import { ITextModelTreeSitter } from "../../../../editor/common/services/treeSitterParserService.js";
|
|
7
|
-
import { ITreeSitterImporter } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/treeSitterParserService.service";
|
|
8
|
-
import { ITreeSitterParserService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/treeSitterParserService.service";
|
|
9
|
-
import { IModelTokensChangedEvent } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/textModelEvents";
|
|
10
|
-
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
11
|
-
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
12
|
-
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
13
|
-
import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
|
|
14
|
-
import { ITreeSitterTokenizationStoreService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model/treeSitterTokenStoreService.service";
|
|
15
|
-
import { TokenUpdate } from "../../../../editor/common/model/tokenStore.js";
|
|
16
|
-
import { Range } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range";
|
|
17
|
-
import { IWorkbenchThemeService } from "@codingame/monaco-vscode-7443a901-21f6-577a-9674-42893b997ee0-common/vscode/vs/workbench/services/themes/common/workbenchThemeService.service";
|
|
18
|
-
import { ITreeSitterTokenizationFeature } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/treeSitter/browser/treeSitterTokenizationFeature.service";
|
|
19
|
-
type TreeSitterQueries = string;
|
|
20
|
-
export declare const TREESITTER_BASE_SCOPES: Record<string, string>;
|
|
21
|
-
export declare class TreeSitterTokenizationFeature extends Disposable implements ITreeSitterTokenizationFeature {
|
|
22
|
-
private readonly _treeSitterImporter;
|
|
23
|
-
private readonly _languageService;
|
|
24
|
-
private readonly _configurationService;
|
|
25
|
-
private readonly _instantiationService;
|
|
26
|
-
private readonly _fileService;
|
|
27
|
-
_serviceBrand: undefined;
|
|
28
|
-
private readonly _tokenizersRegistrations;
|
|
29
|
-
constructor(_treeSitterImporter: ITreeSitterImporter, _languageService: ILanguageService, _configurationService: IConfigurationService, _instantiationService: IInstantiationService, _fileService: IFileService);
|
|
30
|
-
private _getSetting;
|
|
31
|
-
private _handleGrammarsExtPoint;
|
|
32
|
-
private _fetchQueries;
|
|
33
|
-
private _createTokenizationSupport;
|
|
34
|
-
}
|
|
35
|
-
export declare class TreeSitterTokenizationSupport extends Disposable implements ITreeSitterTokenizationSupport {
|
|
36
|
-
private readonly _queries;
|
|
37
|
-
private readonly Query;
|
|
38
|
-
private readonly _languageId;
|
|
39
|
-
private readonly _languageIdCodec;
|
|
40
|
-
private readonly _treeSitterService;
|
|
41
|
-
private readonly _themeService;
|
|
42
|
-
private readonly _tokenizationStoreService;
|
|
43
|
-
private readonly _instantiationService;
|
|
44
|
-
private _query;
|
|
45
|
-
private readonly _onDidChangeTokens;
|
|
46
|
-
readonly onDidChangeTokens: Event<{
|
|
47
|
-
textModel: ITextModel;
|
|
48
|
-
changes: IModelTokensChangedEvent;
|
|
49
|
-
}>;
|
|
50
|
-
private readonly _onDidCompleteBackgroundTokenization;
|
|
51
|
-
readonly onDidChangeBackgroundTokenization: Event<{
|
|
52
|
-
textModel: ITextModel;
|
|
53
|
-
}>;
|
|
54
|
-
private _colorThemeData;
|
|
55
|
-
private _languageAddedListener;
|
|
56
|
-
private _codeEditors;
|
|
57
|
-
private _encodedLanguage;
|
|
58
|
-
constructor(_queries: TreeSitterQueries, Query: typeof Parser.Query, _languageId: string, _languageIdCodec: ILanguageIdCodec, _treeSitterService: ITreeSitterParserService, _themeService: IWorkbenchThemeService, _tokenizationStoreService: ITreeSitterTokenizationStoreService, _instantiationService: IInstantiationService);
|
|
59
|
-
private get _encodedLanguageId();
|
|
60
|
-
private _setInitialTokens;
|
|
61
|
-
private _forceParseAndTokenizeContent;
|
|
62
|
-
private _parseAndTokenizeViewPort;
|
|
63
|
-
guessTokensForLinesContent(lineNumber: number, textModel: ITextModel, lines: string[]): Uint32Array[] | undefined;
|
|
64
|
-
private _emptyTokensForOffsetAndLength;
|
|
65
|
-
private _createEmptyTokens;
|
|
66
|
-
private _firstTreeUpdate;
|
|
67
|
-
private _setViewPortTokens;
|
|
68
|
-
private _handleTreeUpdate;
|
|
69
|
-
private _updateTreeForRanges;
|
|
70
|
-
private _refreshNeedsRefresh;
|
|
71
|
-
private _rangeTokensAsUpdates;
|
|
72
|
-
getTokensInRange(textModel: ITextModel, range: Range, rangeStartOffset: number, rangeEndOffset: number, tree?: Parser.Tree, captures?: QueryCapture[]): TokenUpdate[] | undefined;
|
|
73
|
-
private _getTree;
|
|
74
|
-
private _ensureQuery;
|
|
75
|
-
private _updateTheme;
|
|
76
|
-
captureAtPosition(lineNumber: number, column: number, textModel: ITextModel): QueryCapture[];
|
|
77
|
-
captureAtRangeTree(range: Range, tree: Parser.Tree, textModelTreeSitter: ITextModelTreeSitter | undefined): QueryCapture[];
|
|
78
|
-
private _captureAtRange;
|
|
79
|
-
private _captureAtRangeWithInjections;
|
|
80
|
-
tokenizeEncoded(lineNumber: number, textModel: ITextModel): undefined;
|
|
81
|
-
tokenizeEncodedInstrumented(lineNumber: number, textModel: ITextModel): {
|
|
82
|
-
result: Uint32Array;
|
|
83
|
-
captureTime: number;
|
|
84
|
-
metadataTime: number;
|
|
85
|
-
} | undefined;
|
|
86
|
-
private _getCaptures;
|
|
87
|
-
private _tokenize;
|
|
88
|
-
private _createTokensFromCaptures;
|
|
89
|
-
private _getInjectionCaptures;
|
|
90
|
-
private _tokenizeCapturesWithMetadata;
|
|
91
|
-
private _emptyToken;
|
|
92
|
-
private _tokenizeEncoded;
|
|
93
|
-
private _endOffsetTokensToUint32Array;
|
|
94
|
-
dispose(): void;
|
|
95
|
-
}
|
|
96
|
-
export {};
|