Skip to content

Commit

Permalink
Multiple key detection fixed at single line
Browse files Browse the repository at this point in the history
  • Loading branch information
Mustafa Kuru committed Jun 14, 2022
1 parent 134b46d commit a35c756
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ It can be made to work in various projects by changing the regex information and

## Change Log

##### v1.0.5
- Multiple resource key detection fixed at the single line for Hover and Code Action Providers.

##### v1.0.4
- Logs forwarded to the custom i18 CodeLens output channel.
- Minor fixes.

##### v1.0.3

Performance tweaks & refactored with new features
Expand All @@ -18,7 +25,7 @@ Performance tweaks & refactored with new features
- Similar providers centralized.
- All settings and reloading data's moved to SettingUtils.
- Resource delete action added for Code or Resource file
- Action & Conmfiguration settings renamed properly.
- Action & Configuration settings renamed properly.
- Resource hover text fixed after save.

##### v1.0.2
Expand Down
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": "i18n-codelens",
"displayName": "i18n CodeLens",
"description": "i18n CodeLens makes it easy to find missing language resources, provides various Code Actions, Hover Information, and tips for you to add or edit the language resources.",
"version": "1.0.4",
"version": "1.0.5",
"publisher": "mustafa-kuru",
"author": {
"email": "[email protected]",
Expand Down
3 changes: 2 additions & 1 deletion src/codeAction/ResourceEditCodeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export class ResourceEditCodeAction implements vscode.CodeActionProvider {
if (isResourceFile) {
key = SettingUtils.getResourceLineMatch(line.text)?.groups?.key;
} else if (isCodeFile) {
key = SettingUtils.getResourceCodeMatch(line.text)?.groups?.key;
const keyRange = document.getWordRangeAtPosition(range.start, SettingUtils.getResourceLineRegex());
key = document.getText(keyRange);
}
if (!key) return;

Expand Down
5 changes: 2 additions & 3 deletions src/providers/HoverProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import SettingUtils from '../SettingUtils';

export class HoverProvider implements vscode.HoverProvider {
provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken) {

const line = document.lineAt(position.line);
const key = SettingUtils.getResourceLineMatch(line.text)?.groups?.key;
const keyRange = document.getWordRangeAtPosition(position, SettingUtils.getResourceLineRegex());
const key = document.getText(keyRange);
if (!key) return;

if (SettingUtils.isResourceFilePath(document.uri.path)) {
Expand Down

0 comments on commit a35c756

Please sign in to comment.