Skip to content

Commit 9f5d3eb

Browse files
authored
Pick up latest markdown language service and clean up server package (microsoft#164516)
- Picks up newest markdown language service - Excludes some files from server publish - Delete unused file - Update readme - Align server version with LS version
1 parent eca16a8 commit 9f5d3eb

File tree

6 files changed

+183
-18
lines changed

6 files changed

+183
-18
lines changed

extensions/markdown-language-features/server/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This server uses the [Markdown Language Service](https://github.com/microsoft/vs
3434
- Organize link definitions source action.
3535
- Extract link to definition refactoring.
3636

37-
- (experimental) Updating links when a file is moved / renamed. Uses a custom `markdown/getEditForFileRenames` message.
37+
- Updating links when a file is moved / renamed. Uses a custom `markdown/getEditForFileRenames` message.
3838

3939
- [Pull diagnostics (validation)](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics) for links.
4040

@@ -56,6 +56,10 @@ The server supports the following settings:
5656
- `suggest`
5757
- `paths`
5858
- `enabled` — Enable/disable path suggestions.
59+
60+
- `occurrencesHighlight`
61+
- `enabled` — Enable/disable highlighting of link occurrences.
62+
5963
- `validate`
6064
- `enabled` — Enable/disable all validation.
6165
- `referenceLinks`
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
{
22
"name": "vscode-markdown-languageserver",
33
"description": "Markdown language server",
4-
"version": "0.0.0-alpha-5",
4+
"version": "0.2.0-alpha.4",
55
"author": "Microsoft Corporation",
66
"license": "MIT",
77
"engines": {
88
"node": "*"
99
},
1010
"main": "./out/node/main",
1111
"browser": "./dist/browser/main",
12+
"files": [
13+
"dist/**/*.js",
14+
"out/**/*.js"
15+
],
1216
"dependencies": {
1317
"vscode-languageserver": "^8.0.2",
1418
"vscode-languageserver-textdocument": "^1.0.5",
1519
"vscode-languageserver-types": "^3.17.1",
16-
"vscode-markdown-languageservice": "^0.2.0-alpha.3",
20+
"vscode-markdown-languageservice": "^0.2.0-alpha.4",
1721
"vscode-nls": "^5.2.0",
1822
"vscode-uri": "^3.0.3"
1923
},
@@ -22,6 +26,7 @@
2226
},
2327
"scripts": {
2428
"compile": "gulp compile-extension:markdown-language-features-server",
29+
"prepublishOnly": "npm run compile",
2530
"watch": "gulp watch-extension:markdown-language-features-server"
2631
}
2732
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Markdown Language Server
2+
3+
> **❗ Import** This is still in development. While the language server is being used by VS Code, it has not yet been tested with other clients.
4+
5+
The Markdown language server powers VS Code's built-in markdown support, providing tools for writing and browsing Markdown files. It runs as a separate executable and implements the [language server protocol](https://microsoft.github.io/language-server-protocol/overview).
6+
7+
This server uses the [Markdown Language Service](https://github.com/microsoft/vscode-markdown-languageservice) to implement almost all of the language features. You can use that library if you need a library for working with Markdown instead of a full language server.
8+
9+
10+
## Server capabilities
11+
12+
- [Completions](https://microsoft.github.io/language-server-protocol/specification#textDocument_completion) for Markdown links.
13+
14+
- [Folding](https://microsoft.github.io/language-server-protocol/specification#textDocument_foldingRange) of Markdown regions, block elements, and header sections.
15+
16+
- [Smart selection](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_selectionRange) for inline elements, block elements, and header sections.
17+
18+
- [Document Symbols](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol) for quick navigation to headers in a document.
19+
20+
- [Workspace Symbols](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_symbol) for quick navigation to headers in the workspace
21+
22+
- [Document links](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentLink) for making Markdown links in a document clickable.
23+
24+
- [Find all references](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_references) to headers and links across all Markdown files in the workspace.
25+
26+
- [Go to definition](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition) from links to headers or link definitions.
27+
28+
- [Rename](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_rename) of headers and links across all Markdown files in the workspace.
29+
30+
- Find all references to a file. Uses a custom `markdown/getReferencesToFileInWorkspace` message.
31+
32+
- [Code Actions](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction)
33+
34+
- Organize link definitions source action.
35+
- Extract link to definition refactoring.
36+
37+
- Updating links when a file is moved / renamed. Uses a custom `markdown/getEditForFileRenames` message.
38+
39+
- [Pull diagnostics (validation)](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics) for links.
40+
41+
42+
## Client requirements
43+
44+
### Initialization options
45+
46+
The client can send the following initialization options to the server:
47+
48+
- `markdownFileExtensions` Array file extensions that should be considered as Markdown. These should not include the leading `.`. For example: `['md', 'mdown', 'markdown']`.
49+
50+
### Settings
51+
52+
Clients may send a `workspace/didChangeConfiguration` notification to notify the server of settings changes.
53+
The server supports the following settings:
54+
55+
- `markdown`
56+
- `suggest`
57+
- `paths`
58+
- `enabled` — Enable/disable path suggestions.
59+
60+
- `occurrencesHighlight`
61+
- `enabled` — Enable/disable highlighting of link occurrences.
62+
63+
- `validate`
64+
- `enabled` — Enable/disable all validation.
65+
- `referenceLinks`
66+
- `enabled` — Enable/disable validation of reference links: `[text][ref]`
67+
- `fragmentLinks`
68+
- `enabled` — Enable/disable validation of links to fragments in the current files: `[text](#head)`
69+
- `fileLinks`
70+
- `enabled` — Enable/disable validation of links to file in the workspace.
71+
- `markdownFragmentLinks` — Enable/disable validation of links to headers in other Markdown files. Use `inherit` to inherit the `fragmentLinks` setting.
72+
- `ignoredLinks` — Array of glob patterns for files that should not be validated.
73+
- `unusedLinkDefinitions`
74+
- `enabled` — Enable/disable validation of unused link definitions.
75+
- `duplicateLinkDefinitions`
76+
- `enabled` — Enable/disable validation of duplicated link definitions.
77+
78+
### Custom requests
79+
80+
To support all of the features of the language server, the client needs to implement a few custom request types. The definitions of these request types can be found in [`protocol.ts`](./src/protocol.ts)
81+
82+
#### `markdown/parse`
83+
84+
Get the tokens for a Markdown file. Clients are expected to use [Markdown-it](https://github.com/markdown-it/markdown-it) for this.
85+
86+
We require that clients bring their own version of Markdown-it so that they can customize/extend Markdown-it.
87+
88+
#### `markdown/fs/readFile`
89+
90+
Read the contents of a file in the workspace.
91+
92+
#### `markdown/fs/readDirectory`
93+
94+
Read the contents of a directory in the workspace.
95+
96+
#### `markdown/fs/stat`
97+
98+
Check if a given file/directory exists in the workspace.
99+
100+
#### `markdown/fs/watcher/create`
101+
102+
Create a file watcher. This is needed for diagnostics support.
103+
104+
#### `markdown/fs/watcher/delete`
105+
106+
Delete a previously created file watcher.
107+
108+
#### `markdown/findMarkdownFilesInWorkspace`
109+
110+
Get a list of all markdown files in the workspace.
111+
112+
113+
## Contribute
114+
115+
The source code of the Markdown language server can be found in the [VSCode repository](https://github.com/microsoft/vscode) at [extensions/markdown-language-features/server](https://github.com/microsoft/vscode/tree/master/extensions/markdown-language-features/server).
116+
117+
File issues and pull requests in the [VSCode GitHub Issues](https://github.com/microsoft/vscode/issues). See the document [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute) on how to build and run from source.
118+
119+
Most of the functionality of the server is located in libraries:
120+
121+
- [vscode-markdown-languageservice](https://github.com/microsoft/vscode-markdown-languageservice) contains the implementation of all features as a reusable library.
122+
- [vscode-languageserver-node](https://github.com/microsoft/vscode-languageserver-node) contains the implementation of language server for NodeJS.
123+
124+
Help on any of these projects is very welcome.
125+
126+
## Code of Conduct
127+
128+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
129+
130+
## License
131+
132+
Copyright (c) Microsoft Corporation. All rights reserved.
133+
134+
Licensed under the [MIT](https://github.com/microsoft/vscode/blob/master/LICENSE.txt) License.
135+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "vscode-markdown-languageserver",
3+
"description": "Markdown language server",
4+
"version": "0.2.0-alpha.4",
5+
"author": "Microsoft Corporation",
6+
"license": "MIT",
7+
"engines": {
8+
"node": "*"
9+
},
10+
"main": "./out/node/main",
11+
"browser": "./dist/browser/main",
12+
"files": [
13+
"dist/**/*.js",
14+
"out/**/*.js"
15+
],
16+
"dependencies": {
17+
"vscode-languageserver": "^8.0.2",
18+
"vscode-languageserver-textdocument": "^1.0.5",
19+
"vscode-languageserver-types": "^3.17.1",
20+
"vscode-markdown-languageservice": "^0.2.0-alpha.4",
21+
"vscode-nls": "^5.2.0",
22+
"vscode-uri": "^3.0.3"
23+
},
24+
"devDependencies": {
25+
"@types/node": "16.x"
26+
},
27+
"scripts": {
28+
"compile": "gulp compile-extension:markdown-language-features-server",
29+
"prepublishOnly": "npm run compile",
30+
"watch": "gulp watch-extension:markdown-language-features-server"
31+
}
32+
}

extensions/markdown-language-features/server/src/util/arrays.ts

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

extensions/markdown-language-features/server/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ vscode-languageserver@^8.0.2:
4242
dependencies:
4343
vscode-languageserver-protocol "3.17.2"
4444

45-
vscode-markdown-languageservice@^0.2.0-alpha.3:
46-
version "0.2.0-alpha.3"
47-
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.2.0-alpha.3.tgz#5bc3934ebb97ce855f49fbb345a5e1f5ace7d660"
48-
integrity sha512-3ikmh1Mcr9s5s0wZZsxb7heSzKooudCgtZzL5d8t94WDbg02u9i2cDYF6qufK6Og5pBSC3ajeF12qFAYbRIbgQ==
45+
vscode-markdown-languageservice@^0.2.0-alpha.4:
46+
version "0.2.0-alpha.4"
47+
resolved "https://registry.yarnpkg.com/vscode-markdown-languageservice/-/vscode-markdown-languageservice-0.2.0-alpha.4.tgz#51856ffa9750782bf952fe97765fb29c3ec27c06"
48+
integrity sha512-a08s+AEwPTYqilMW8ZF3FAeDf+5pUo+XOgynPHvc70ABFTTr9fNVlg99quFUQINvi/eihH8+cd3/j/Qijeauew==
4949
dependencies:
5050
picomatch "^2.3.1"
5151
vscode-languageserver-textdocument "^1.0.5"

0 commit comments

Comments
 (0)