Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ The JSON configuration file consists of an array of server instance descriptions
- The `routing` property is an optional object that describes your project's routing configuration
- The `frontmatter` property is a string that tells the extension which property in the Markdoc file's YAML frontmatter contains the URL route associated with the file

### Standalone Server Configuration

When using the server standalone without the client VS Code extension you can pass the configuration object to your LSP client like so:

```json
{
"root": "/path/to/project/root",
"path": "relative/path/to/markdoc/files",
"config": {
"root": "/path/to/project/root",
"path": "relative/path/to/markdoc/files"
}
}
```

Invoke the server with `markdoc-ls --stdio` from within your LSP client.

### File extensions

In order to distinguish Markdoc files from Markdown files, the Visual Studio Code extension expects Markdoc files to use one of the following file extensions: `.markdoc`, `.markdoc.md`, or `.mdoc`.
Expand Down
3 changes: 2 additions & 1 deletion build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import {context, build} from 'esbuild';

const config = {
bundle: true,
entryPoints: ['client/index.ts', 'server/index.ts', 'client/server.ts'],
entryPoints: ['client/index.ts', 'server/index.ts', 'server/wrapper.ts', 'client/server.ts'],
outdir: 'dist',
sourcemap: 'linked',
external: ['vscode'],
platform: 'node',
format: 'cjs',
banner: { js: '#!/usr/bin/env node' },
};

if (process.argv.includes('--watch')) {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"url": "https://github.com/markdoc/language-server.git"
},
"main": "./dist/client/index.js",
"bin": {
"markdoc-ls": "dist/server/wrapper.js"
},
"scripts": {
"build": "node build.mjs",
"build:watch": "node build.mjs --watch",
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@markdoc/language-server",
"name": "@fjorn/markdoc-ls",
"version": "0.0.12",
"description": "A Markdoc language server",
"main": "dist/index.js",
Expand Down
3 changes: 2 additions & 1 deletion server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ export function connect(
});

return new Promise((resolve) => {
connection.onInitialized(() => resolve(options));
const options = connection.onInitialized(() => resolve(options));
connection.listen();
return options
});
}

Expand Down
3 changes: 3 additions & 0 deletions server/wrapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { server } from './server';

server();