Skip to content

Commit

Permalink
Fix the issue where document.getWordRangeAtPosition() returns incorre…
Browse files Browse the repository at this point in the history
…ct positions due to changes in the document before the results from getStyles() are returned.
  • Loading branch information
VioSea-hub committed Dec 12, 2024
1 parent 455dda1 commit a002857
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-html-css",
"displayName": "HTML CSS Support",
"description": "CSS Intellisense for HTML",
"version": "2.0.11",
"version": "2.0.12",
"license": "MIT",
"publisher": "ecmel",
"author": {
Expand Down
4 changes: 2 additions & 2 deletions src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ export class Provider implements CompletionItemProvider, DefinitionProvider {
position: Position,
type: StyleType
) {
const map = await this.getCompletionMap(document, type);
const range = document.getWordRangeAtPosition(position, this.wordRange);
const map = await this.getCompletionMap(document, type);
const items = [];

for (const item of map.values()) {
Expand Down Expand Up @@ -164,8 +164,8 @@ export class Provider implements CompletionItemProvider, DefinitionProvider {
}

private async getDefinitions(document: TextDocument, position: Position) {
const styles = await this.getStyles(document);
const range = document.getWordRangeAtPosition(position, this.wordRange);
const styles = await this.getStyles(document);
const selector = document.getText(range);
const locations: Location[] = [];

Expand Down

0 comments on commit a002857

Please sign in to comment.