Skip to content

Commit

Permalink
Remove support for Node.js 12, update unified-engine
Browse files Browse the repository at this point in the history
Closes GH-45.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>

* This mainly uses `yaml` to correctly support YAML 1.2
* The server now implements LSP 3.17 (which should be backwards compatible)
  • Loading branch information
remcohaszing committed Jun 18, 2022
1 parent 1358330 commit a3448a1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
- ubuntu-latest
- windows-latest
node:
- lts/erbium
- lts/fermium
- lts/gallium
6 changes: 4 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function vfileMessageToDiagnostic(message) {
}

if (message.expected) {
// type-coverage:ignore-next-line
diagnostic.data = {
expected: message.expected
}
Expand Down Expand Up @@ -458,12 +459,13 @@ export function createUnifiedLanguageServer({
}

for (const diagnostic of event.context.diagnostics) {
const {data} = diagnostic
// type-coverage:ignore-next-line
const data = /** @type {{expected?: unknown[]}} */ (diagnostic.data)
if (typeof data !== 'object' || !data) {
continue
}

const {expected} = /** @type {{expected?: unknown[]}} */ (data)
const {expected} = data

if (!Array.isArray(expected)) {
continue
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"dependencies": {
"@types/unist": "^2.0.0",
"find-up": "^6.0.0",
"load-plugin": "^4.0.0",
"unified-engine": "^9.0.0",
"load-plugin": "^5.0.0",
"unified-engine": "^10.0.0",
"vfile": "^5.0.0",
"vfile-message": "^3.0.0",
"vscode-languageserver": "^7.0.0",
"vscode-languageserver": "^8.0.0",
"vscode-languageserver-textdocument": "^1.0.0"
},
"devDependencies": {
Expand All @@ -53,7 +53,7 @@
"typescript": "^4.0.0",
"unified": "^10.0.0",
"vscode-languageserver-protocol": "^3.0.0",
"xo": "^0.48.0"
"xo": "^0.50.0"
},
"scripts": {
"prepack": "npm run build",
Expand All @@ -72,7 +72,10 @@
"trailingComma": "none"
},
"xo": {
"prettier": true
"prettier": true,
"rules": {
"capitalized-comments": "off"
}
},
"remarkConfig": {
"plugins": [
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ various editors.
## Install

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
In Node.js (version 14.14+, or 16.0+), install with [npm][]:

```sh
npm install unified-language-server
Expand Down Expand Up @@ -209,11 +209,11 @@ server features:

Projects maintained by the unified collective are compatible with all maintained
versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
As of now, that is Node.js 14.14+, and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.

This project uses [`vscode-languageserver`][vscode-languageserver] 7, which
implements language server protocol 3.16.0.
implements language server protocol 3.17.0.
It should work anywhere where LSP 3.6.0 or later is implemented.

## Related
Expand Down
7 changes: 2 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ test('uninstalled processor w/ `defaultProcessor`', async (t) => {

t.deepEqual(
cleanStack(log.message, 2).replace(/(imported from )[^\r\n]+/, '$1zzz'),
"Cannot find `xxx-missing-yyy` locally but using `defaultProcessor`, original error:\nError [ERR_MODULE_NOT_FOUND]: Cannot find package 'xxx-missing-yyy' imported from zzz",
"Cannot find `xxx-missing-yyy` locally but using `defaultProcessor`, original error:\nError: Cannot find package 'xxx-missing-yyy' imported from zzz",
'should work w/ `defaultProcessor`'
)
})
Expand Down Expand Up @@ -679,10 +679,7 @@ test('`workspace/didChangeWorkspaceFolders`', async (t) => {
workspaceFolders: [{uri: processCwd.href, name: ''}]
})

await new Promise((resolve) => {
connection.onRequest('client/registerCapability', resolve)
connection.sendNotification('initialized', {})
})
connection.sendNotification('initialized', {})

const otherCwd = new URL('folder/', processCwd)

Expand Down

0 comments on commit a3448a1

Please sign in to comment.