-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use @types/vscode and vscode-test instead of vscode package
- Loading branch information
Showing
24 changed files
with
423 additions
and
870 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.vscode-test | ||
lib | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { all } = require('eslint-config-1stg/overrides') | ||
|
||
module.exports = { | ||
extends: '1stg', | ||
overrides: [ | ||
...all, | ||
{ | ||
files: '*.ts', | ||
rules: { | ||
'@typescript-eslint/no-floating-promises': 0, | ||
}, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"prettier --write", | ||
"git add" | ||
], | ||
"*.{mdx,ts}": [ | ||
"*.{mdx,ts,tsx}": [ | ||
"eslint", | ||
"git add" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
.vscode/** | ||
**/*.ts | ||
**/*.map | ||
.gitignore | ||
**/tsconfig.json | ||
**/tsconfig.base.json | ||
contributing.md | ||
.travis.yml | ||
client/node_modules/** | ||
!client/node_modules/vscode-jsonrpc/** | ||
!client/node_modules/vscode-languageclient/** | ||
!client/node_modules/vscode-languageserver-protocol/** | ||
!client/node_modules/vscode-languageserver-types/** | ||
!client/node_modules/semver/** | ||
.* | ||
*.log | ||
*.ts | ||
*.map | ||
tsconfig.json | ||
tsconfig.base.json | ||
tsconfig.tsbuildinfo | ||
node_modules | ||
yarn.lock | ||
!/node_modules/vscode-jsonrpc/** | ||
!/node_modules/vscode-languageclient/** | ||
!/node_modules/vscode-languageserver-protocol/** | ||
!/node_modules/vscode-languageserver-types/** | ||
!/node_modules/semver/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ignore-engines true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,32 @@ | ||
# LSP Example | ||
# [Visual Studio Code](https://code.visualstudio.com) extension for [MDX] | ||
|
||
Heavily documented sample code for https://code.visualstudio.com/api/language-extensions/language-server-extension-guide | ||
Adds language support for [MDX]. | ||
|
||
## Functionality | ||
## Installation | ||
|
||
This Language Server works for plain text file. It has the following language features: | ||
- Completions | ||
- Diagnostics regenerated on each file change or configuration change | ||
You can install this extension from the [Marketplace](https://marketplace.visualstudio.com/items?itemName=JounQin.vscode-mdx). | ||
|
||
It also includes an End-to-End test. | ||
## What about `.md` files? | ||
|
||
## Structure | ||
By default the MDX language is applied only to `.mdx` files. If MDX files in your project end with `.md`, you can tell VS Code that by adding the following to your workspace settings: | ||
|
||
```json | ||
"files.associations": { | ||
"*.md": "mdx" | ||
}, | ||
``` | ||
. | ||
├── client // Language Client | ||
│ ├── src | ||
│ │ ├── test // End to End tests for Language Client / Server | ||
│ │ └── extension.ts // Language Client entry point | ||
├── package.json // The extension manifest. | ||
└── server // Language Server | ||
└── src | ||
└── server.ts // Language Server entry point | ||
|
||
## Auto-close tags | ||
|
||
If you want VS Code to automatically close tags while you type, you can install [Auto Close Tag](https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-close-tag) and configure it to also include the language `mdx`: | ||
|
||
```json | ||
"auto-close-tag.activationOnLanguage": [ | ||
"xml", | ||
"php", | ||
"...", | ||
"mdx" | ||
] | ||
``` | ||
|
||
## Running the Sample | ||
|
||
- Run `npm install` in this folder. This installs all necessary npm modules in both the client and server folder | ||
- Open VS Code on this folder. | ||
- Press Ctrl+Shift+B to compile the client and server. | ||
- Switch to the Debug viewlet. | ||
- Select `Launch Client` from the drop down. | ||
- Run the launch config. | ||
- If you want to debug the server as well use the launch configuration `Attach to Server` | ||
- In the [Extension Development Host] instance of VSCode, open a document in 'plain text' language mode. | ||
- Type `j` or `t` to see `Javascript` and `TypeScript` completion. | ||
- Enter text content such as `AAA aaa BBB`. The extension will emit diagnostics for all words in all-uppercase. | ||
[mdx]: https://github.com/mdx-js/mdx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,15 @@ | ||
{ | ||
"name": "vscode-mdx-client", | ||
"version": "0.1.1", | ||
"description": "Client of MDX extension for Visual Studio Code", | ||
"author": "JounQin", | ||
"license": "MIT", | ||
"version": "0.1.0", | ||
"publisher": "JounQin", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/rx-ts/vscode-mdx" | ||
}, | ||
"license": "MIT", | ||
"repository": "git@github.com:rx-ts/vscode-mdx.git", | ||
"engines": { | ||
"vscode": "^1.23.0" | ||
}, | ||
"scripts": { | ||
"update-vscode": "vscode-install", | ||
"postinstall": "vscode-install" | ||
}, | ||
"dependencies": { | ||
"vscode-languageclient": "^5.2.1" | ||
}, | ||
"devDependencies": { | ||
"vscode": "^1.1.36" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
import path from 'path' | ||
|
||
import * as testRunner from 'vscode/lib/testrunner' | ||
import { runTests } from 'vscode-test' | ||
|
||
testRunner.configure({ | ||
ui: 'bdd', | ||
useColors: true, | ||
timeout: 100000, | ||
}) | ||
async function main() { | ||
try { | ||
// The folder containing the Extension Manifest package.json | ||
// Passed to `--extensionDevelopmentPath` | ||
const extensionDevelopmentPath = path.resolve(__dirname, '../../') | ||
|
||
module.exports = testRunner | ||
// The path to the extension test script | ||
// Passed to --extensionTestsPath | ||
const extensionTestsPath = path.resolve(__dirname, './suite/index') | ||
|
||
// Download VS Code, unzip it and run the integration test | ||
await runTests({ extensionDevelopmentPath, extensionTestsPath }) | ||
} catch (err) { | ||
console.error('Failed to run tests') | ||
process.exit(1) | ||
} | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import path from 'path' | ||
|
||
import Mocha from 'mocha' | ||
import glob from 'glob' | ||
|
||
export function run(): Promise<void> { | ||
// Create the mocha test | ||
const mocha = new Mocha({ | ||
ui: 'tdd', | ||
}) | ||
mocha.useColors(true) | ||
|
||
const testsRoot = path.resolve(__dirname, '..') | ||
|
||
return new Promise((resolve, reject) => { | ||
glob('**/**.test.ts', { cwd: testsRoot }, (err, files) => { | ||
if (err) { | ||
return reject(err) | ||
} | ||
|
||
// Add files to the test suite | ||
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))) | ||
|
||
try { | ||
// Run the mocha test | ||
mocha.run(failures => { | ||
if (failures > 0) { | ||
reject(new Error(`${failures} tests failed.`)) | ||
} else { | ||
resolve() | ||
} | ||
}) | ||
} catch (err) { | ||
reject(err) | ||
} | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.