Skip to content

Commit d45379d

Browse files
committed
chore: use @types/vscode and vscode-test instead of vscode package
1 parent 87b0a4f commit d45379d

24 files changed

+423
-870
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
.vscode-test
12
lib
23
node_modules

.eslintrc

Lines changed: 0 additions & 9 deletions
This file was deleted.

.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const { all } = require('eslint-config-1stg/overrides')
2+
3+
module.exports = {
4+
extends: '1stg',
5+
overrides: [
6+
...all,
7+
{
8+
files: '*.ts',
9+
rules: {
10+
'@typescript-eslint/no-floating-promises': 0,
11+
},
12+
},
13+
],
14+
}

.lintstagedrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"prettier --write",
44
"git add"
55
],
6-
"*.{mdx,ts}": [
6+
"*.{mdx,ts,tsx}": [
77
"eslint",
88
"git add"
99
]

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22

3-
node_js: stable
3+
node_js: --lts
44

55
cache: yarn
66

@@ -11,6 +11,5 @@ before_install:
1111
- git config --global user.email '[email protected]'
1212

1313
script:
14-
- set -e
1514
- yarn lint
16-
- yarn compile
15+
- yarn build

.vscodeignore

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
.vscode/**
2-
**/*.ts
3-
**/*.map
4-
.gitignore
5-
**/tsconfig.json
6-
**/tsconfig.base.json
7-
contributing.md
8-
.travis.yml
9-
client/node_modules/**
10-
!client/node_modules/vscode-jsonrpc/**
11-
!client/node_modules/vscode-languageclient/**
12-
!client/node_modules/vscode-languageserver-protocol/**
13-
!client/node_modules/vscode-languageserver-types/**
14-
!client/node_modules/semver/**
1+
.*
2+
*.log
3+
*.ts
4+
*.map
5+
tsconfig.json
6+
tsconfig.base.json
7+
tsconfig.tsbuildinfo
8+
node_modules
9+
yarn.lock
10+
!/node_modules/vscode-jsonrpc/**
11+
!/node_modules/vscode-languageclient/**
12+
!/node_modules/vscode-languageserver-protocol/**
13+
!/node_modules/vscode-languageserver-types/**
14+
!/node_modules/semver/**

.yarnrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore-engines true

README.md

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
1-
# LSP Example
1+
# [Visual Studio Code](https://code.visualstudio.com) extension for [MDX]
22

3-
Heavily documented sample code for https://code.visualstudio.com/api/language-extensions/language-server-extension-guide
3+
Adds language support for [MDX].
44

5-
## Functionality
5+
## Installation
66

7-
This Language Server works for plain text file. It has the following language features:
8-
- Completions
9-
- Diagnostics regenerated on each file change or configuration change
7+
You can install this extension from the [Marketplace](https://marketplace.visualstudio.com/items?itemName=JounQin.vscode-mdx).
108

11-
It also includes an End-to-End test.
9+
## What about `.md` files?
1210

13-
## Structure
11+
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:
1412

13+
```json
14+
"files.associations": {
15+
"*.md": "mdx"
16+
},
1517
```
16-
.
17-
├── client // Language Client
18-
│ ├── src
19-
│ │ ├── test // End to End tests for Language Client / Server
20-
│ │ └── extension.ts // Language Client entry point
21-
├── package.json // The extension manifest.
22-
└── server // Language Server
23-
└── src
24-
└── server.ts // Language Server entry point
18+
19+
## Auto-close tags
20+
21+
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`:
22+
23+
```json
24+
"auto-close-tag.activationOnLanguage": [
25+
"xml",
26+
"php",
27+
"...",
28+
"mdx"
29+
]
2530
```
2631

27-
## Running the Sample
28-
29-
- Run `npm install` in this folder. This installs all necessary npm modules in both the client and server folder
30-
- Open VS Code on this folder.
31-
- Press Ctrl+Shift+B to compile the client and server.
32-
- Switch to the Debug viewlet.
33-
- Select `Launch Client` from the drop down.
34-
- Run the launch config.
35-
- If you want to debug the server as well use the launch configuration `Attach to Server`
36-
- In the [Extension Development Host] instance of VSCode, open a document in 'plain text' language mode.
37-
- Type `j` or `t` to see `Javascript` and `TypeScript` completion.
38-
- Enter text content such as `AAA aaa BBB`. The extension will emit diagnostics for all words in all-uppercase.
32+
[mdx]: https://github.com/mdx-js/mdx

client/package.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
{
22
"name": "vscode-mdx-client",
3+
"version": "0.1.1",
34
"description": "Client of MDX extension for Visual Studio Code",
45
"author": "JounQin",
5-
"license": "MIT",
6-
"version": "0.1.0",
76
"publisher": "JounQin",
8-
"repository": {
9-
"type": "git",
10-
"url": "https://github.com/rx-ts/vscode-mdx"
11-
},
7+
"license": "MIT",
8+
"repository": "[email protected]:rx-ts/vscode-mdx.git",
129
"engines": {
1310
"vscode": "^1.23.0"
1411
},
15-
"scripts": {
16-
"update-vscode": "vscode-install",
17-
"postinstall": "vscode-install"
18-
},
1912
"dependencies": {
2013
"vscode-languageclient": "^5.2.1"
21-
},
22-
"devDependencies": {
23-
"vscode": "^1.1.36"
2414
}
2515
}

client/src/extension.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
import * as path from 'path'
77

8-
import { workspace, ExtensionContext } from 'vscode'
98
import {
109
LanguageClient,
1110
LanguageClientOptions,
1211
ServerOptions,
1312
TransportKind,
1413
} from 'vscode-languageclient'
1514

15+
import { workspace, ExtensionContext } from 'vscode'
16+
1617
let client: LanguageClient
1718

1819
export function activate(context: ExtensionContext) {

0 commit comments

Comments
 (0)