Skip to content

Commit 8b81c4f

Browse files
committed
Inititial commit
0 parents  commit 8b81c4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3438
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
out/**
2+
node_modules/**
3+
vsc-extension-quickstart.md
4+
*.vsix
5+
_NOTEPAD.md

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"ms-vscode.vscode-typescript-tslint-plugin"
6+
]
7+
}

.vscode/launch.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"runtimeExecutable": "${execPath}",
13+
"args": [
14+
"--extensionDevelopmentPath=${workspaceFolder}"
15+
],
16+
"outFiles": [
17+
"${workspaceFolder}/out/**/*.js"
18+
],
19+
"preLaunchTask": "npm: watch"
20+
},
21+
{
22+
"name": "Extension Tests",
23+
"type": "extensionHost",
24+
"request": "launch",
25+
"runtimeExecutable": "${execPath}",
26+
"args": [
27+
"--extensionDevelopmentPath=${workspaceFolder}",
28+
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
29+
],
30+
"outFiles": [
31+
"${workspaceFolder}/out/test/**/*.js"
32+
],
33+
"preLaunchTask": "npm: watch"
34+
}
35+
]
36+
}

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false // set this to true to hide the "out" folder with the compiled JS files
5+
},
6+
"search.exclude": {
7+
"out": true // set this to false to include "out" folder in search results
8+
},
9+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10+
"typescript.tsc.autoDetect": "off",
11+
"spellright.language": [
12+
"en"
13+
],
14+
"spellright.documentTypes": [
15+
"markdown",
16+
"latex",
17+
"plaintext"
18+
]
19+
}

.vscode/tasks.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$tsc-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
20+
}

.vscodeignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.vscode/**
2+
.vscode-test/**
3+
out/test/**
4+
src/**
5+
.gitignore
6+
vsc-extension-quickstart.md
7+
**/tsconfig.json
8+
**/tslint.json
9+
**/*.map
10+
**/*.ts
11+
_NOTEPAD.md
12+
readme_assets/**

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Change Log
2+
3+
All notable changes to the "string-checker-js" extension will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [0.0.1]
10+
11+
- Initial release.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Michel Caradec
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# String Checker JS
2+
3+
Scan TypeScript and JavaScript documents for non-technical strings.
4+
5+
The aim is to help identifying strings in code that might need to be translated.
6+
Such strings should be moved in a dedicated resource file for translation purpose.
7+
8+
## Features
9+
10+
**Scan** workspace documents, and **navigate** from string to string in source code:
11+
12+
![demo-scan-workspace](readme_assets/demo-scan-workspace.gif)
13+
14+
**Switch** view to browse detected strings:
15+
16+
![demo-switch-view](readme_assets/demo-switch-view.gif)
17+
18+
Add **custom rules** to improve string detection:
19+
20+
![demo-exclude-token](readme_assets/demo-exclude-token.gif)
21+
22+
**Search** for strings in view:
23+
24+
![demo-filter](readme_assets/demo-filter.gif)
25+
26+
### Detection providers
27+
28+
Strings are evaluated by different providers, each being dedicated to a specific area.
29+
30+
| Provider | Description | Example |
31+
|---|---|---|
32+
| Keywords provider | Detects strings from **user list**. | "far fa-smile" will be detected as a [Font Awesome smile icon](https://fontawesome.com/icons/smile?style=regular). |
33+
| Class provider | Detects strings as **class names**. | |
34+
| Code provider | Detects strings as **code** (variable names). | "../path/to/my/file" will be detected as a path.<br>"someVariable" will be detected as a camel case variable. |
35+
| Natural language provider | Detects strings as **natural language**. | ["Ceci n'est pas une pipe"](https://en.wikipedia.org/wiki/Ren%C3%A9_Magritte) will be detected as french language. |
36+
| Entropy provider | Detects string as **[Gibberish](https://en.wikipedia.org/wiki/Gibberish)**.<br>String [entropy](https://en.wikipedia.org/wiki/Entropy_(information_theory)) threshold can be configured in settings (`entropy.threshold`, default = 3). | "abbcccddddeeeee" has an entropy of 2.15.<br>"dd/MM/yyyy hh:mm:ss" has an entropy of 2.88.<br>["Gloubi-boulga"](https://fr.wikipedia.org/wiki/Gloubi-boulga) has an entropy of 2.93. |
37+
| String provider | **Pass-through** detection. | *Any string will be detected as such.* |
38+
39+
The `string.checker.js.testString` [command](#extension-settings) brings a convenient way to test all providers for a given string.
40+
41+
<!-- TODO: Image URLs in README.md and CHANGELOG.md need to resolve to https URLs. -->
42+
43+
![demo-test-string](readme_assets/demo-test-string.gif)
44+
45+
## Requirements
46+
47+
*There are no known requirements.*
48+
49+
## Extension Settings
50+
51+
This extension contributes the following settings:
52+
53+
- `string.checker.js.scanDocument`: scan selected document.
54+
- `string.checker.js.scanDocumentIncludeAll`: scan selected document for any string.
55+
- `string.checker.js.scanDocumentWorkspace`: scan workspace documents.
56+
- `string.checker.js.scanDocumentWorkspaceIncludeAll`: scan workspace documents for any string.
57+
- `string.checker.js.switchView`: switch between file/token and token/file view.
58+
- `string.checker.js.excludeParentFolderPath`: exclude a file (using its path) containing folder from scan [1].
59+
- `string.checker.js.excludeParentFolderName`: exclude a file (using its name) containing folder from scan [1].
60+
- `string.checker.js.excludeFilePath`: exclude a file (using its path) from scan [1].
61+
- `string.checker.js.excludeFileName`: exclude a file (using its name) from scan [1].
62+
- `string.checker.js.excludeToken`: exclude a token from scan result.
63+
- `string.checker.js.includeToken`: include a token to scan result.
64+
- `string.checker.js.selectTreeItem`: select token in document.
65+
- `string.checker.js.filterTokens`: filter tokens view.
66+
- `string.checker.js.testString`: test a string with all detection [providers](#detection-providers).
67+
- `string.checker.js.showVersion`: display String Checker JS version.
68+
69+
- [1] **Path exclusion** is based on the full path (`/path/to/my/file.js`), while **name exclusion** only uses the last part (`file.js`for a file, `my`for a folder), which means if the same name is found in another folder, it will be excluded too.
70+
71+
## Known Issues
72+
73+
Here are a few common issues.
74+
75+
- String detection by language provider is based on statistical analysis. The longer the string, the more accurate the detection.
76+
77+
## Release Notes
78+
79+
### 0.0.1
80+
81+
Initial release.
82+
83+
## Mentions
84+
85+
- [Font Awesome](https://fontawesome.com/icons/) icon is used for tokens activity bar.
86+
- [freeicons.io](https://www.freeicons.io/) icons are used for tokens view.
87+
- [franc](https://github.com/wooorm/franc) library is used for natural language detection.
88+
- [TypeScript-Node-Starter](https://github.com/Microsoft/TypeScript-Node-Starter) Microsoft sample project is used for demonstration purpose.

assets/activity-bar.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)