Skip to content

Commit

Permalink
fix: Hoist the extension to be based upon the repository root (#762)
Browse files Browse the repository at this point in the history
* [WIP] Hoist the extension to be based upon repo root

The packaged extension was bundled from `packages/client`
based upon the old way of setting up a language server based extension.
The new way is to bundle from the root and exclude everything but the wanted files.

* dev: fix packaging the extension
  • Loading branch information
Jason3S authored Mar 18, 2021
1 parent 923a3ff commit 08a04a1
Show file tree
Hide file tree
Showing 34 changed files with 7,089 additions and 919 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
'**/*.d.ts',
'**/node_modules/**',
'packages/client/server/**',
'packages/*/dist/**',
],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ node_modules

**/.vscode-test

/temp
packages/*/{dist,out,temp}/**

!**/server/.vscode
!**/client/.vscode
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Client: Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/packages/client/dist/**/*.js"
],
"smartStep": true,
"skipFiles": [
"<node_internals>/**"
]
}
],
"compounds": []
}
23 changes: 23 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*
*/**
**/.DS_Store
!CHANGELOG.md
!images/SpellCheck.png
!packages/_server/dist/api.js
!packages/_server/dist/main.js
!packages/_server/dist/main.js.LICENSE.txt
!packages/_server/node_modules/@cspell/cspell-bundled-dicts/**
!packages/_server/node_modules/@cspell/dict*/**/{README.md,LICENSE}
!packages/_server/node_modules/@cspell/dict*/**/*.{json,gz}
!packages/_server/node_modules/regexp-worker/**/{LICENSE,package.json,README.md}
!packages/_server/node_modules/regexp-worker/**/*.js
!packages/_server/package.json
!packages/client/cspell.code-snippets
!packages/client/dist/*.js
!packages/client/dist/*.txt
!packages/client/License.txt
!packages/client/package.json
!packages/client/settingsViewer/*.{js,html,LICENSE.txt}
!packages/client/settingsViewer/api/**/*.{js,html,LICENSE.txt}
!packages/client/settingsViewer/webapp/*.{js,html,LICENSE.txt}
!resources/**
141 changes: 141 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# vscode-spell-checker

[![](https://vsmarketplacebadge.apphb.com/installs-short/streetsidesoftware.code-spell-checker.svg)](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
[![](https://vsmarketplacebadge.apphb.com/rating-short/streetsidesoftware.code-spell-checker.svg)](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
[![](https://vsmarketplacebadge.apphb.com/version-short/streetsidesoftware.code-spell-checker.svg)](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)

[![Build & Test Actions Status](https://github.com/streetsidesoftware/vscode-spell-checker/workflows/build-test/badge.svg)](https://github.com/streetsidesoftware/vscode-spell-checker/actions)
[![Integration Tests Actions Status](https://github.com/streetsidesoftware/vscode-spell-checker/workflows/Integration%20Tests/badge.svg)](https://github.com/streetsidesoftware/vscode-spell-checker/actions)
[![Lint Actions Status](https://github.com/streetsidesoftware/vscode-spell-checker/workflows/lint/badge.svg)](https://github.com/streetsidesoftware/vscode-spell-checker/actions)

A simple source code spell checker for multiple programming languages.

For the readme on the plugin: [README](./packages/client/README.md).

## Contributions

## Building the extension

1. `npm install`
1. Launch vscode: `code Spell Checker.code-workspace`
1. Run the extension from vscode:
1. `Debug Tab`
1. Choose `Launch Extension` configuration.
1. `F5`

<sup>\*</sup> Requires Node >= 12

### Debugging the Client

1. Launch vscode: `code packages/client`
1. Run the extension from vscode: `F5`

### Debugging the Server

1. Launch vscode for the server: `code packages/_server`
1. Launch the client as specified above.
1. Attach to the server: `F5` or `Debug -> Attach Server`

Sometimes the ports get stuck. You can see if they are being used with:

```bash
netstat -anp tcp | grep 60048
```

Use the following command to find the process id (PID):

```bash
lsof -i tcp:60048
```

If anything shows up, then the port is still locked.

## Packages

- `client` - the actual extension running in VS Code.
- `_server` - the extension server that processes spell checker requests
- `_settingsViewer` - a webapp that provides a visual interface to the configuration files.
- `_integrationTests` - a test suite that launches the extension in VS Code.

## Dictionaries / Word List

Improvements to existing word lists and new word lists are welcome.

All dictionaries are being migrated to [cspell-dicts](https://github.com/Jason3S/cspell-dicts).
Some dictionaries are still located at [cspell](https://github.com/Jason3S/cspell)/[dictionaries](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell-lib/dictionaries).

### Format for Dictionary Word lists

The simplest format is one word per line.

```text
apple
banana
orange
grape
pineapple
```

For programming languages, a word list might look like this:

```php
ZipArchive::addGlob
ZipArchive::addPattern
ZipArchive::close
ZipArchive::deleteIndex
ZipArchive::deleteName
ZipArchive::extractTo
```

The word list complier will convert camelCase and snake_case words into a simple word list.
This is both for speed and predictability.

```php
ZipArchive::deleteIndex
```

becomes:

```text
zip
archive
delete
index
```

Spaces between words in the word list have a special meaning.

```text
New Delhi
New York
Los Angeles
```

becomes in the compiled dictionary:

```text
new delhi
new
delhi
new york
york
los angeles
los
angeles
```

Spaces in the compiled dictionary have a special meaning.
They tell the suggestion algorithm to suggest: 'newYork', 'new_york', 'new york', etc. for 'newyork'.

### Locals

The default language is English: `"cSpell.language": "en"`

cSpell currently has English locals: `en-US` and `en-GB`.

Example words differences: behaviour (en-GB) vs behavior (en-US)

<!---
cSpell:ignore newyork lsof netstat
cSpell:words behaviour behavior
-->
Loading

0 comments on commit 08a04a1

Please sign in to comment.