Coder Social home page Coder Social logo

Comments (3)

SaharBahloul avatar SaharBahloul commented on July 29, 2024

You need to change the part of your code that collects annotations to only do so from the currently opened file. Here’s a conceptual modification you can make: function triggerUpdateDecorations() {
if (activeEditor) {
updateDecorations(activeEditor);
}
}

function updateDecorations(editor) {
if (!editor || !editor.document) return;

const text = editor.document.getText();
const matches = [];
let match;
while (match = pattern.exec(text)) {
    const startPos = editor.document.positionAt(match.index);
    const endPos = editor.document.positionAt(match.index + match[0].length);
    const decoration = { range: new vscode.Range(startPos, endPos), hoverMessage: match[0] };
    matches.push(decoration);
}

editor.setDecorations(annotationDecorationType, matches);

}
Ensure that when the extension is activated or when the active editor is changed, the annotations are updated accordingly:vscode.window.onDidChangeActiveTextEditor(editor => {
activeEditor = editor;
if (editor) {
triggerUpdateDecorations();
}
}, null, context.subscriptions);

from vscode-todo-highlight.

Liniik avatar Liniik commented on July 29, 2024

What are you talking about? Didn't you mean to post it as a PR? I don't have any "my" code. My issue is to let the author know he's missing a feature which was there

from vscode-todo-highlight.

SaharBahloul avatar SaharBahloul commented on July 29, 2024

Hello [@Liniik],

Apologies for the confusion— I realize my previous message may have given the wrong impression. I am not the maintainer of this project nor am I suggesting changes through a PR at this moment.

I was actually expressing a user's perspective, hoping to highlight a feature that was very useful in previous versions and seems to be missing now. My aim was to bring this to the attention of the actual maintainers, as this feature significantly aids in managing large projects.

Thanks for your efforts on this extension, and sorry for any mix-up!

Best regards,
sahar

from vscode-todo-highlight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.