File tree Expand file tree Collapse file tree
src/vs/editor/contrib/codelens/browser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -279,8 +279,18 @@ class CodeLens {
279279 } ) ;
280280 }
281281
282- public updateCodeLensSymbols ( data : ICodeLensData [ ] ) : void {
282+ public updateCodeLensSymbols ( data : ICodeLensData [ ] , helper : CodeLensHelper ) : void {
283+ while ( this . _decorationIds . length ) {
284+ helper . removeDecoration ( this . _decorationIds . pop ( ) ) ;
285+ }
283286 this . _data = data ;
287+ this . _decorationIds = new Array < string > ( this . _data . length ) ;
288+ this . _data . forEach ( ( codeLensData , i ) => {
289+ helper . addDecoration ( {
290+ range : codeLensData . symbol . range ,
291+ options : { }
292+ } , id => this . _decorationIds [ i ] = id ) ;
293+ } ) ;
284294 }
285295
286296 public computeIfNecessary ( currentModelsVersionId : number , model : editorCommon . IModel ) : ICodeLensData [ ] {
@@ -556,7 +566,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
556566 this . _lenses [ codeLensIndex ] . dispose ( helper , accessor ) ;
557567 this . _lenses . splice ( codeLensIndex , 1 ) ;
558568 } else if ( codeLensLineNumber === symbolsLineNumber ) {
559- this . _lenses [ codeLensIndex ] . updateCodeLensSymbols ( groups [ groupsIndex ] ) ;
569+ this . _lenses [ codeLensIndex ] . updateCodeLensSymbols ( groups [ groupsIndex ] , helper ) ;
560570 groupsIndex ++ ;
561571 codeLensIndex ++ ;
562572 } else {
You can’t perform that action at this time.
0 commit comments