Skip to content

Commit 9a90a77

Browse files
committed
Initial checkin for Persian
1 parent 954348e commit 9a90a77

15 files changed

+483
-0
lines changed

extensions/persian/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
out
2+
node_modules
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
{
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"name": "Launch Extension",
7+
"type": "extensionHost",
8+
"request": "launch",
9+
"runtimeExecutable": "${execPath}",
10+
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
11+
"stopOnEntry": false,
12+
"sourceMaps": true,
13+
"outFiles": [ "${workspaceRoot}/out/src/**/*.js" ],
14+
"preLaunchTask": "npm: build"
15+
},
16+
{
17+
"name": "Launch Tests",
18+
"type": "extensionHost",
19+
"request": "launch",
20+
"runtimeExecutable": "${execPath}",
21+
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
22+
"stopOnEntry": false,
23+
"sourceMaps": true,
24+
"outFiles": [ "${workspaceRoot}/out/test/**/*.js" ],
25+
"preLaunchTask": "npm: build"
26+
}
27+
]
28+
}

extensions/persian/.vscode/tasks.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"identifier": "build",
8+
"label": "build",
9+
"type": "npm",
10+
"script": "build",
11+
"group": {
12+
"kind": "build",
13+
"isDefault": true
14+
},
15+
"problemMatcher": "$tsc"
16+
},
17+
{
18+
"identifier": "clean-build",
19+
"type": "npm",
20+
"script": "build",
21+
"problemMatcher": "$tsc"
22+
},
23+
{
24+
"identifier": "test",
25+
"type": "npm",
26+
"script": "test",
27+
"group": {
28+
"kind": "test",
29+
"isDefault": true
30+
}
31+
},
32+
{
33+
"identifier": "watch",
34+
"type": "npm",
35+
"script": "watch",
36+
"problemMatcher": ["$tsc-watch"]
37+
}
38+
]
39+
}

extensions/persian/.vscodeignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode/**
2+
.vscode-test/**
3+
out/test/**
4+
test/**
5+
src/**
6+
**/*.map
7+
.gitignore
8+
tsconfig.json
9+
vsc-extension-quickstart.md

extensions/persian/CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
All notable changes to the "code-spell-checker-persian" extension will be documented in this file.
3+
4+
## [Unreleased]
5+
- Initial release
6+
7+
## References
8+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
9+

extensions/persian/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Jason Dent
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.

extensions/persian/README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Persian - Code Spell Checker
2+
3+
Persian dictionary extension for VS Code.
4+
5+
Imports the Persian spell checking dictionary for [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker).
6+
7+
8+
9+
## Installation
10+
11+
After this extension is installed, it is necessary to tell the spell checker to use it.
12+
13+
### Enable Dictionary
14+
15+
Commands (use `F1` or *View -> Command Palette...*):
16+
- `F1` `Show Spell Checker Configuration Info`
17+
- Select the `Language` tab.
18+
- Enable the language Globally or in just the Workspace.
19+
20+
### Disable Dictionary
21+
22+
Commands (use `F1` or *View -> Command Palette...*):
23+
- `F1` `Show Spell Checker Configuration Info`
24+
- Select the `Language` tab.
25+
- Disable the language Globally or in just the Workspace.
26+
27+
### Manual Settings
28+
29+
This is done with the `language` setting.
30+
31+
*Preferences* -> *Settings*
32+
33+
Adding `fa` to the `cSpell.language` setting, will enable the Persian dictionary.
34+
Example using both English and Persian dictionaries:
35+
```javascript
36+
"cSpell.language": "en,fa",
37+
```
38+
39+
40+
41+
## Requirements
42+
This extension will automatically include [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) extension.
199 KB
Loading

extensions/persian/package-lock.json

+98
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/persian/package.json

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"name": "code-spell-checker-persian",
3+
"description": "Persian dictionary extension for VS Code.",
4+
"version": "0.1.0",
5+
"displayName": "Persian - Code Spell Checker",
6+
"icon": "images/SpellCheck.png",
7+
"preview": true,
8+
"private": true,
9+
"publisher": "streetsidesoftware",
10+
"engines": {
11+
"vscode": "^1.33.0"
12+
},
13+
"categories": [
14+
"Linters",
15+
"Other"
16+
],
17+
"keywords": [
18+
"Persian",
19+
"VS Code Extension",
20+
"Spelling Checker",
21+
"dictionary",
22+
"spelling"
23+
],
24+
"activationEvents": [
25+
"*"
26+
],
27+
"qna": "marketplace",
28+
"main": "./out/src/extension",
29+
"contributes": {
30+
"commands": [
31+
{
32+
"command": "cSpellExt_persian.enablePersian",
33+
"title": "Enable Persian Spell Checker Dictionary"
34+
},
35+
{
36+
"command": "cSpellExt_persian.disablePersian",
37+
"title": "Disable Persian Spell Checker Dictionary"
38+
},
39+
{
40+
"command": "cSpellExt_persian.enablePersianWorkspace",
41+
"title": "Enable Persian Spell Checker Dictionary in Workspace"
42+
},
43+
{
44+
"command": "cSpellExt_persian.disablePersianWorkspace",
45+
"title": "Disable Persian Spell Checker Dictionary in Workspace"
46+
}
47+
]
48+
},
49+
"extensionDependencies": [
50+
"streetsidesoftware.code-spell-checker"
51+
],
52+
"repository": {
53+
"type": "git",
54+
"url": "https://github.com/Jason3S/vscode-cspell-dict-extensions"
55+
},
56+
"bugs": {
57+
"url": "https://github.com/Jason3S/vscode-cspell-dict-extensions/issues"
58+
},
59+
"license": "MIT",
60+
"scripts": {
61+
"clean": "rimraf out",
62+
"clean-build": "npm run clean && npm run build",
63+
"vscode:prepublish": "npm run build",
64+
"build": "tsc -p ./",
65+
"prepare": "npm run build",
66+
"watch": "tsc -watch -p ./",
67+
"test": "node ../../node_modules/vscode/bin/test"
68+
},
69+
"dependencies": {
70+
"cspell-dict-fa-ir": "^1.0.3"
71+
}
72+
}

extensions/persian/src/extension.ts

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
'use strict';
2+
// The module 'vscode' contains the VS Code extensibility API
3+
// Import the module and reference it with the alias vscode in your code below
4+
import * as vscode from 'vscode';
5+
import * as dict from 'cspell-dict-fa-ir';
6+
7+
interface CodeSpellCheckerExtension {
8+
registerConfig(path: string): Promise<void>;
9+
enableLocal(isGlobal: boolean, local: string): Promise<void>;
10+
disableLocal(isGlobal: boolean, local: string): Promise<void>;
11+
}
12+
13+
14+
const local = 'fa';
15+
16+
17+
// this method is called when your extension is activated
18+
// your extension is activated the very first time the command is executed
19+
export function activate(context: vscode.ExtensionContext) {
20+
21+
const vscodeSpellCheckerExtension = 'streetsidesoftware.code-spell-checker';
22+
23+
const extension = vscode.extensions.getExtension<CodeSpellCheckerExtension>(vscodeSpellCheckerExtension);
24+
25+
if (extension) {
26+
extension.activate().then(ext => {
27+
const path = dict.getConfigLocation();
28+
// We need to register the dictionary configuration with the Code Spell Checker Extension
29+
ext && ext.registerConfig && ext.registerConfig(path);
30+
});
31+
}
32+
33+
34+
function enablePersian(isGlobal: boolean) {
35+
extension && extension.activate().then(ext => {
36+
ext && ext.enableLocal && ext.enableLocal(isGlobal, local);
37+
});
38+
}
39+
40+
function disablePersian(isGlobal: boolean) {
41+
extension && extension.activate().then(ext => {
42+
ext && ext.disableLocal && ext.disableLocal(isGlobal, local);
43+
});
44+
}
45+
46+
// Push the disposable to the context's subscriptions so that the
47+
// client can be deactivated on extension deactivation
48+
context.subscriptions.push(
49+
vscode.commands.registerCommand('cSpellExt_persian.enablePersian', () => enablePersian(true)),
50+
vscode.commands.registerCommand('cSpellExt_persian.disablePersian', () => disablePersian(true)),
51+
vscode.commands.registerCommand('cSpellExt_persian.enablePersianWorkspace', () => enablePersian(false)),
52+
vscode.commands.registerCommand('cSpellExt_persian.disablePersianWorkspace', () => disablePersian(false)),
53+
);
54+
55+
}
56+
57+
// this method is called when your extension is deactivated
58+
export function deactivate() {
59+
}

0 commit comments

Comments
 (0)