vscode/extensions/markdown-language-features/server
Robo 5216c04428
chore: update to electron 29 (#209818)
* chore: update electron@29.1.0

* chore: update typings to 20.x

* chore: bump electron@29.1.5

* ci: fix crash in compiling extensions-ci

* chore: disable .d.ts check for build/

$ ../node_modules/.bin/tsc -p tsconfig.build.json
node_modules/@types/chokidar/index.d.ts:21:14 - error TS2420: Class 'import("/Users/demohan/github/vscode/build/node_modules/@types/chokidar/index").FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
  Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref

21 export class FSWatcher extends EventEmitter implements fs.FSWatcher {
                ~~~~~~~~~

node_modules/chokidar/types/index.d.ts:8:14 - error TS2420: Class 'import("/Users/demohan/github/vscode/build/node_modules/chokidar/types/index").FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
  Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref

8 export class FSWatcher extends EventEmitter implements fs.FSWatcher {
               ~~~~~~~~~

Found 2 errors in 2 files.

Errors  Files
     1  node_modules/@types/chokidar/index.d.ts:21
     1  node_modules/chokidar/types/index.d.ts:8

Refs a0f9e09f64

* chore: update core types

* temp: fix layer validation

* chore: update nodejs checksums

* ci: use latest v20 LTS for missing node-gyp

Refs eacec5f490

* ci: define LIBCPP_HARDENING_MODE

* ci: fix crash in vscode-web-min-ci

* chore: update rpm deps-list

* chore: bump tree-sitter-typescript@0.20.5

* chore: bump electron@29.3.0

* chore: bump electron@29.3.1

* chore: update rpm deps-list for x86_64

* ci: disable io_uring UV backend on linux

* ci: disable io_uring backend for oss as well

* chore: update typings to 20.x

* ci: add TODO for io_uring workaround

* chore: bump distro

* chore: update preinstall node version checks

* chore: update @types/gulp

Refs https://github.com/microsoft/vscode/issues/212442

* ci: disable io_uring in more test suites
2024-05-11 01:20:28 +09:00
..
.vscode Move MD diagnostics to language server (#155653) 2022-07-19 16:34:09 -07:00
build chore: add Windows as package platform (#206369) 2024-02-27 12:56:12 -08:00
src Pick up latest Markdown language service (#211391) 2024-04-25 13:48:44 -07:00
.npmignore Add npmignore to markdown server (#155898) 2022-07-21 16:21:57 -07:00
CHANGELOG.md Pick up latest markdown language server (#184215) 2023-06-02 23:13:26 +02:00
extension-browser.webpack.config.js Pass translations down to Markdown Language Server (#172884) 2023-01-31 06:29:41 +01:00
extension.webpack.config.js Pass translations down to Markdown Language Server (#172884) 2023-01-31 06:29:41 +01:00
package.json chore: update to electron 29 (#209818) 2024-05-11 01:20:28 +09:00
README.md Fix supported markdown-lint violations in markdown files (#190750) 2023-08-24 08:37:25 +00:00
tsconfig.json Use more restrictive lib for markdown language server (#172873) 2023-01-30 16:52:58 -08:00
yarn.lock chore: update to electron 29 (#209818) 2024-05-11 01:20:28 +09:00

Markdown Language Server

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.

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.

This server uses the Markdown Language Service 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.

Server capabilities

  • Completions for Markdown links.

  • Folding of Markdown regions, block elements, and header sections.

  • Smart selection for inline elements, block elements, and header sections.

  • Document Symbols for quick navigation to headers in a document.

  • Workspace Symbols for quick navigation to headers in the workspace

  • Document links for making Markdown links in a document clickable.

  • Find all references to headers and links across all Markdown files in the workspace.

  • Go to definition from links to headers or link definitions.

  • Rename of headers and links across all Markdown files in the workspace.

  • Find all references to a file. Uses a custom markdown/getReferencesToFileInWorkspace message.

  • Code Actions

    • Organize link definitions source action.
    • Extract link to definition refactoring.
  • Updating links when a file is moved / renamed. Uses a custom markdown/getEditForFileRenames message.

  • Pull diagnostics (validation) for links.

Client requirements

Initialization options

The client can send the following initialization options to the server:

  • markdownFileExtensions Array file extensions that should be considered as Markdown. These should not include the leading .. For example: ['md', 'mdown', 'markdown'].

Settings

Clients may send a workspace/didChangeConfiguration notification to notify the server of settings changes. The server supports the following settings:

  • markdown
    • suggest

      • paths
        • enabled — Enable/disable path suggestions.
    • occurrencesHighlight

      • enabled — Enable/disable highlighting of link occurrences.
    • validate

      • enabled — Enable/disable all validation.
      • referenceLinks
        • enabled — Enable/disable validation of reference links: [text][ref]
      • fragmentLinks
        • enabled — Enable/disable validation of links to fragments in the current files: [text](#head)
      • fileLinks
        • enabled — Enable/disable validation of links to file in the workspace.
        • markdownFragmentLinks — Enable/disable validation of links to headers in other Markdown files. Use inherit to inherit the fragmentLinks setting.
      • ignoredLinks — Array of glob patterns for files that should not be validated.
      • unusedLinkDefinitions
        • enabled — Enable/disable validation of unused link definitions.
      • duplicateLinkDefinitions
        • enabled — Enable/disable validation of duplicated link definitions.

Custom requests

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

markdown/parse

Get the tokens for a Markdown file. Clients are expected to use Markdown-it for this.

We require that clients bring their own version of Markdown-it so that they can customize/extend Markdown-it.

markdown/fs/readFile

Read the contents of a file in the workspace.

markdown/fs/readDirectory

Read the contents of a directory in the workspace.

markdown/fs/stat

Check if a given file/directory exists in the workspace.

markdown/fs/watcher/create

Create a file watcher. This is needed for diagnostics support.

markdown/fs/watcher/delete

Delete a previously created file watcher.

markdown/findMarkdownFilesInWorkspace

Get a list of all markdown files in the workspace.

Contribute

The source code of the Markdown language server can be found in the VSCode repository at extensions/markdown-language-features/server.

File issues and pull requests in the VSCode GitHub Issues. See the document How to Contribute on how to build and run from source.

Most of the functionality of the server is located in libraries:

Help on any of these projects is very welcome.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.