Skip to content

Commit

Permalink
fix: Support Jupyter Notebooks (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Sep 2, 2021
1 parent 69885ab commit 6fe65a6
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cspell-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ IANA
Interop
issuehunt
Jupyter
kotlinscript
KotlinScript
languageclient
lerna
liga
Expand Down
8 changes: 6 additions & 2 deletions docs/_includes/generated-docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ Type
Description
: Control which file schemas will be checked for spelling (VS Code must be restarted for this setting to take effect).

Some schemas have special meaning like:
- `untitled` - Used for new documents that have not yet been saved
- `vscode-notebook-cell` - Used for validating segments of a Notebook.

Default
: [ _`"file"`_, _`"gist"`_, _`"sftp"`_, _`"untitled"`_ ]
: [ _`"file"`_, _`"gist"`_, _`"sftp"`_, _`"untitled"`_, _`"vscode-notebook-cell"`_ ]

---

Expand Down Expand Up @@ -339,7 +343,7 @@ Description
: Specify a list of file types to spell check. It is better to use `cSpell.enableFiletypes` to Enable / Disable checking files types.

Default
: [ _`"asciidoc"`_, _`"c"`_, _`"cpp"`_, _`"csharp"`_, _`"css"`_, _`"git-commit"`_, _`"go"`_, _`"graphql"`_, _`"handlebars"`_, _`"haskell"`_, _`"html"`_, _`"jade"`_, _`"java"`_, _`"javascript"`_, _`"javascriptreact"`_, _`"json"`_, _`"jsonc"`_, _`"latex"`_, _`"less"`_, _`"markdown"`_, _`"php"`_, _`"plaintext"`_, _`"python"`_, _`"pug"`_, _`"restructuredtext"`_, _`"rust"`_, _`"scala"`_, _`"scss"`_, _`"text"`_, _`"typescript"`_, _`"typescriptreact"`_, _`"yaml"`_, _`"yml"`_ ]
: [ _`"asciidoc"`_, _`"c"`_, _`"cpp"`_, _`"csharp"`_, _`"css"`_, _`"git-commit"`_, _`"go"`_, _`"graphql"`_, _`"handlebars"`_, _`"haskell"`_, _`"html"`_, _`"jade"`_, _`"java"`_, _`"javascript"`_, _`"javascriptreact"`_, _`"json"`_, _`"jsonc"`_, _`"jupyter"`_, _`"latex"`_, _`"less"`_, _`"markdown"`_, _`"php"`_, _`"plaintext"`_, _`"python"`_, _`"pug"`_, _`"restructuredtext"`_, _`"rust"`_, _`"scala"`_, _`"scss"`_, _`"text"`_, _`"typescript"`_, _`"typescriptreact"`_, _`"yaml"`_, _`"yml"`_ ]

---

Expand Down
5 changes: 5 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"name": "@internal/docs",
"description": "Documentation",
"private": true,
"version": "0.0.0",
"scripts": {
"build": "echo Skip Docs",
"clean": "rimraf _site",
"build-production": "echo Skip Docs",
"test": "echo Skip Docs",
"gen-docs": "yarn gen-config-docs && yarn gen-command-docs && yarn run lint",
"gen-config-docs": "node _scripts/extract-config.js > _includes/generated-docs/configuration.md",
"gen-command-docs": "node _scripts/extract-commands.js > _includes/generated-docs/commands.md",
Expand Down
1 change: 1 addition & 0 deletions fixtures/workspaces/jupyter/getting-started/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Sample Jupyter Notebook
67 changes: 67 additions & 0 deletions fixtures/workspaces/jupyter/getting-started/sample.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"source": [
"print(\"Hello World!\")\n",
"\n",
"# Check for spelling errors more text."
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Hello World!\n"
]
}
],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"# This is a bit of Markdown\n",
"\n",
"Below is some code.\n",
"\n",
"Let's have a spelling errror.m"
],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"# This is another bit of Markdown\n",
"\n",
"It also has sommme errorss.\n"
],
"metadata": {}
}
],
"metadata": {
"orig_nbformat": 4,
"language_info": {
"name": "python",
"version": "3.9.5",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3.9.5 64-bit"
},
"interpreter": {
"hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@
"javascriptreact",
"json",
"jsonc",
"jupyter",
"latex",
"less",
"markdown",
Expand Down Expand Up @@ -1212,8 +1213,10 @@
"file",
"gist",
"sftp",
"untitled"
]
"untitled",
"vscode-notebook-cell"
],
"markdownDescription": "Control which file schemas will be checked for spelling (VS Code must be restarted for this setting to take effect).\n\nSome schemas have special meaning like:\n- `untitled` - Used for new documents that have not yet been saved\n- `vscode-notebook-cell` - Used for validating segments of a Notebook."
},
"cSpell.overrides": {
"type": "array",
Expand Down Expand Up @@ -2342,9 +2345,11 @@
},
"workspaces": {
"packages": [
"docs",
"packages/*"
],
"nohoist": [
"@internal/docs",
"integration-tests",
"integration-tests/**",
"**/@types/jest-when",
Expand All @@ -2355,10 +2360,11 @@
"build-tools": "build-tools",
"build-package-schema": "yarn workspace server build-schema && build-tools update-package-schema",
"postinstall": "yarn run build",
"build": "yarn workspaces run build && yarn run build-package-schema",
"build": "yarn workspaces run build && yarn run build-package-schema && yarn run gen-docs",
"clean": "yarn workspaces run clean && rimraf \"packages/*/node_modules\"",
"build-production": "yarn workspaces run build-production",
"build-release": "yarn run build && yarn run package-extension",
"gen-docs": "yarn workspace @internal/docs gen-docs",
"version-prerelease-patch": "yarn run version-prerelease -r patch",
"version-prerelease": "yarn run version-release -p alpha",
"version-release": "yarn run test-vsce-build && standard-version",
Expand Down
5 changes: 4 additions & 1 deletion packages/_server/spell-checker-config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
"file",
"gist",
"sftp",
"untitled"
"untitled",
"vscode-notebook-cell"
],
"description": "Control which file schemas will be checked for spelling (VS Code must be restarted for this setting to take effect).",
"items": {
"type": "string"
},
"markdownDescription": "Control which file schemas will be checked for spelling (VS Code must be restarted for this setting to take effect).\n\nSome schemas have special meaning like:\n- `untitled` - Used for new documents that have not yet been saved\n- `vscode-notebook-cell` - Used for validating segments of a Notebook.",
"scope": "window",
"type": "array"
},
Expand Down Expand Up @@ -595,6 +597,7 @@
"javascriptreact",
"json",
"jsonc",
"jupyter",
"latex",
"less",
"markdown",
Expand Down
9 changes: 8 additions & 1 deletion packages/_server/src/config/cspellConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ export interface SpellCheckerSettings extends SpellCheckerShouldCheckDocSettings

/**
* Control which file schemas will be checked for spelling (VS Code must be restarted for this setting to take effect).
* @markdownDescription
* Control which file schemas will be checked for spelling (VS Code must be restarted for this setting to take effect).
*
* Some schemas have special meaning like:
* - `untitled` - Used for new documents that have not yet been saved
* - `vscode-notebook-cell` - Used for validating segments of a Notebook.
* @scope window
* @default ["file", "gist", "sftp", "untitled"]
* @default ["file", "gist", "sftp", "untitled", "vscode-notebook-cell"]
*/
allowedSchemas?: string[];

Expand Down Expand Up @@ -445,6 +451,7 @@ interface CSpellSettingsPackageProperties extends CSpellSettings {
* "javascriptreact",
* "json",
* "jsonc",
* "jupyter",
* "latex",
* "less",
* "markdown",
Expand Down
2 changes: 1 addition & 1 deletion packages/_server/src/config/documentSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const defaultExclude: Glob[] = [
'__pycache__/**', // ignore cache files. cspell:ignore pycache
];

const defaultAllowedSchemes = ['gist', 'file', 'sftp', 'untitled'];
const defaultAllowedSchemes = ['gist', 'file', 'sftp', 'untitled', 'vscode-notebook-cell'];
const schemeBlockList = ['git', 'output', 'debug', 'vscode'];

const defaultRootUri = Uri.file('').toString();
Expand Down

0 comments on commit 6fe65a6

Please sign in to comment.