Skip to content

Fix the issue where document.getWordRangeAtPosition() returns incorre… #299

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

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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