@@ -7,8 +7,6 @@ import * as nls from 'vs/nls';
77import { ICodeEditor } from 'vs/editor/browser/editorBrowser' ;
88import { EditorAction , ServicesAccessor , registerEditorAction } from 'vs/editor/browser/editorExtensions' ;
99import { StopWatch } from 'vs/base/common/stopwatch' ;
10- import { StandardTokenType } from 'vs/editor/common/modes' ;
11- import { ITextModel } from 'vs/editor/common/model' ;
1210
1311class ForceRetokenizeAction extends EditorAction {
1412 constructor ( ) {
@@ -31,51 +29,6 @@ class ForceRetokenizeAction extends EditorAction {
3129 sw . stop ( ) ;
3230 console . log ( `tokenization took ${ sw . elapsed ( ) } ` ) ;
3331
34- if ( ! true ) {
35- extractTokenTypes ( model ) ;
36- }
37- }
38- }
39-
40- function extractTokenTypes ( model : ITextModel ) : void {
41- const eolLength = model . getEOL ( ) . length ;
42- let result : number [ ] = [ ] ;
43- let resultLen : number = 0 ;
44- let lastTokenType : StandardTokenType = StandardTokenType . Other ;
45- let lastEndOffset : number = 0 ;
46- let offset = 0 ;
47- for ( let lineNumber = 1 , lineCount = model . getLineCount ( ) ; lineNumber <= lineCount ; lineNumber ++ ) {
48- const lineTokens = model . getLineTokens ( lineNumber ) ;
49-
50- for ( let i = 0 , len = lineTokens . getCount ( ) ; i < len ; i ++ ) {
51- const tokenType = lineTokens . getStandardTokenType ( i ) ;
52- if ( tokenType === StandardTokenType . Other ) {
53- continue ;
54- }
55-
56- const startOffset = offset + lineTokens . getStartOffset ( i ) ;
57- const endOffset = offset + lineTokens . getEndOffset ( i ) ;
58- const length = endOffset - startOffset ;
59-
60- if ( length === 0 ) {
61- continue ;
62- }
63-
64- if ( lastTokenType === tokenType && lastEndOffset === startOffset ) {
65- result [ resultLen - 2 ] += length ;
66- lastEndOffset += length ;
67- continue ;
68- }
69-
70- result [ resultLen ++ ] = startOffset ; // - lastEndOffset
71- result [ resultLen ++ ] = length ;
72- result [ resultLen ++ ] = tokenType ;
73-
74- lastTokenType = tokenType ;
75- lastEndOffset = endOffset ;
76- }
77-
78- offset += lineTokens . getLineContent ( ) . length + eolLength ;
7932 }
8033}
8134
0 commit comments