Skip to content

Commit

Permalink
Performance tweaks & refactored with new features
Browse files Browse the repository at this point in the history
- Resource Tree view added to Explorer with new configs.
- 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.
- Resource hover text fixed after save.
- Version bump to 1.0.3
  • Loading branch information
Mustafa Kuru committed Mar 20, 2022
1 parent 1fca88e commit 7455d07
Show file tree
Hide file tree
Showing 32 changed files with 1,087 additions and 715 deletions.
45 changes: 33 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,27 @@ i18n CodeLens, makes it easy to find missing language resources, provides variou

It can be made to work in various projects by changing the regex information and glob pattern.

## Demo

![Demo](/demo.gif)

## Change Log

##### v1.0.3

Performance tweaks & refactored with new features

- Resource Tree view added to Explorer with new configs.
- 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.
- Resource hover text fixed after save.

##### v1.0.2

- Fix: Missing glob validation added to shows properly.

##### v1.0.1

- Definition Provider added so that the language resource references can be found with 'go to definition' command or ctrl + click.
Expand All @@ -17,32 +34,36 @@ It can be made to work in various projects by changing the regex information and

- Initial release

## Demo

![Demo](/demo.gif)

## Settings

#### `enableCodeLens`
#### `codeLens`

- Enable or disable the CodeLens for missing resource code. Default: `true`

#### `enableResourceAutoSaveInsertOrUpdate`
#### `resourceAutoSave`

- Enable auto save for resource file(s) that saves files after inserted or updated resource data. Default: `true`

#### `enableUnderlineResourceDecorator`
#### `underlineCodeDecorator`

- Enable or disable the underline decorator for missing resource code(s). Default: `true`

#### `enableAutoFocusDocumentAfterAltered`
#### `autoFocusAfterModified`

- Enable auto focus document after inserted or updated target resource file(s). Default: `false`

#### `languageGlobPattern`
#### `revealResourceInTreeView`

- Enable or disable the automatic reveal resource item in the Resource Tree View when selected resource file on the editor. Default: `false`

#### `resourceTreeViewVisible`

- Enable or disable the Resource Tree View. Default: `true`

#### `resourceFilesGlobPattern`

- Language file glob patterns. (Language resource files must be key value object files.) `**/locales/*.json`
- Language file glob patterns (Language resource files must be key value object files). Default: `**/locales/*.json`

#### `languageTranslatorRegex`
#### `resourceCodeDetectionRegex`

- Regex to detect hover or codeLenses for Language Default: `(?<=T\\(['\"])[a-zA-Z0-9.-]+?(?=['\"]\\))`
- Regex to detect hover or codeLenses for Language Default: `(?<=T\\(['\"])(?<key>[a-zA-Z0-9.-]+?)(?=['\"]\\))`
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 37 additions & 16 deletions 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.2",
"version": "1.0.3",
"publisher": "mustafa-kuru",
"author": {
"email": "[email protected]",
Expand All @@ -24,60 +24,80 @@
"onLanguage:typescript",
"onLanguage:typescriptreact",
"onLanguage:javascript",
"onLanguage:javascriptreact"
"onLanguage:javascriptreact",
"onLanguage:json"
],
"main": "./out/extension",
"contributes": {
"views": {
"explorer": [
{
"id": "i18nResourceDefinitions",
"name": "i18n Resource Definitions",
"when": "config.i18n-codelens.resourceTreeViewVisible && resourceLangId in i18TreeView.supportedLanguages"
}
]
},
"commands": [
{
"title": "Enable CodeLens",
"command": "i18n-codelens.enableCodeLens",
"command": "i18n-codelens.enableCodeLensAction",
"category": "i18n CodeLens"
},
{
"title": "Disable Codelens",
"command": "i18n-codelens.disableCodeLens",
"command": "i18n-codelens.disableCodeLensAction",
"category": "i18n CodeLens"
},
{
"title": "Refresh Language Resources",
"command": "i18n-codelens.refreshLanguageResources",
"title": "Reset cache and reload",
"command": "i18n-codelens.resetAndReloadExtensionAction",
"category": "i18n CodeLens"
}
],
"configuration": {
"properties": {
"i18n-codelens.enableCodeLens": {
"i18n-codelens.codeLens": {
"type": "boolean",
"default": true,
"description": "Enable or disable the CodeLens for missing resource code."
},
"i18n-codelens.enableResourceAutoSaveInsertOrUpdate": {
"i18n-codelens.resourceAutoSave": {
"type": "boolean",
"default": true,
"description": "Enable auto save for resource file(s) that saves files after inserted or updated resource data."
"description": "Enable auto save for resource file(s) that saves files after inserted or updated resource data."
},
"i18n-codelens.enableUnderlineResourceDecorator": {
"i18n-codelens.underlineCodeDecorator": {
"type": "boolean",
"default": true,
"description": "Enable or disable the underline decorator for missing resource code(s)."
},
"i18n-codelens.enableAutoFocusDocumentAfterAltered": {
"i18n-codelens.autoFocusAfterModified": {
"type": "boolean",
"default": false,
"description": "Enable auto focus document after inserted or updated target resource file(s)."
},
"i18n-codelens.languageGlobPattern": {
"i18n-codelens.revealResourceInTreeView": {
"type": "boolean",
"default": false,
"description": "Enable or disable the automatic reveal resource item in the Resource Tree View when selected resource file on the editor."
},
"i18n-codelens.resourceTreeViewVisible": {
"type": "boolean",
"default": true,
"description": "Enable or disable the Resource Tree View"
},
"i18n-codelens.resourceFilesGlobPattern": {
"type": "string",
"description": "Language file glob patterns. (Language resource files must be key value object files.)",
"editPresentation": "singlelineText",
"default": "**/locales/*.json"
},
"i18n-codelens.languageTranslatorRegex": {
"i18n-codelens.resourceCodeDetectionRegex": {
"type": "string",
"description": "Regex to detect hover or codeLenses for Language",
"description": "Regex to detect hover or codeLenses for resource key.",
"editPresentation": "singlelineText",
"default": "(?<=T\\(['\"])[a-zA-Z0-9.-]+?(?=['\"]\\))"
"default": "(?<=T\\(['\"])(?<key>[a-zA-Z0-9.-]+?)(?=['\"]\\))"
}
}
}
Expand All @@ -90,6 +110,7 @@
"watch": "tsc -watch -p ./"
},
"devDependencies": {
"@types/lodash": "^4.14.180",
"@types/minimatch": "^3.0.5",
"@types/node": "^12.12.0",
"@types/vscode": "^1.26.0",
Expand All @@ -103,4 +124,4 @@
"fastest-levenshtein": "^1.0.12",
"minimatch": "^5.0.1"
}
}
}
5 changes: 5 additions & 0 deletions resources/dark/dot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/dark/lang-error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/dark/lang-normal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/dark/lang-warn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions resources/light/dot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/light/lang-error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/light/lang-normal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7455d07

Please sign in to comment.