Comments (3)
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.
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.
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)
- toggle terminal command is not working
- Extension Host terminated unexpectedly
- Extension Host terminated unexpectedly
- TS debugging: vscode shows extensionHostProcess.js and stops working if TODO-highlight is enabled.
- How to work with Rust?
- the extension causing the undent issue
- How can I use the command mode of npm run to perform checks?
- Typo in README.md and package.json
- custom colors not working HOT 5
- Weird highlight on "TODO" HOT 2
- Even if vsc is turned off and turned on again So that the color marked (highlighted) on the text is maintained as it is what should i do to do it?
- F2 Renaming error
- Feature: Export todohighlight.listAnnotations result to file
- Repear & Reproduce Windows 10 Home Version 22H2
- Não sei o que tá acontecendo
- Error in example keywordsPattern and keywords mutually exclusive or bug?
- defautlStyle not applying to built-in "TODO:" and "FIXME:" without keywordsPattern
- Ouhno
- Improve Handling and Visibility of REVIEW Annotations in VSCode Extension
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-todo-highlight.