Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] How to remove the previous decorations permanently ? #4840

Open
2 tasks done
naganand123 opened this issue Feb 26, 2025 · 0 comments
Open
2 tasks done

[Bug] How to remove the previous decorations permanently ? #4840

naganand123 opened this issue Feb 26, 2025 · 0 comments

Comments

@naganand123
Copy link

naganand123 commented Feb 26, 2025

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

goToRefSelection(range: any, editorInstance: ICodeEditor) {
    editorInstance.focus();
    let decorationsCollection = editorInstance.createDecorationsCollection();
    const decorations = [{
      range: new monaco.Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn),
      options: {
        inlineClassName: 'go-to-definition-highlight',
      },   
    }];

    decorationsCollection.set(decorations);
    setTimeout(() => {
      decorationsCollection.clear();
      decorationsCollection = null;
      decorationsCollection.set([]);
      
    }, 5000);
    
  }

Reproduction Steps

No response

Actual (Problematic) Behavior

after some duration removing the decoration, but when I call this method next with new decoration, previous decoration is also applying.

Expected Behavior

Need to removing the previous decorations and apply the new decorations.

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant