Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/alex-vscode
alex wrapper to easily integrate with Visual Studio Code
https://github.com/shinnn/alex-vscode
alex equality javascript language-server nodejs text-processing visual-studio-code wrapper
Last synced: 27 days ago
JSON representation
alex wrapper to easily integrate with Visual Studio Code
- Host: GitHub
- URL: https://github.com/shinnn/alex-vscode
- Owner: shinnn
- License: mit
- Created: 2015-11-30T17:50:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-07T07:51:03.000Z (4 months ago)
- Last Synced: 2024-09-25T09:25:25.309Z (about 2 months ago)
- Topics: alex, equality, javascript, language-server, nodejs, text-processing, visual-studio-code, wrapper
- Language: JavaScript
- Size: 40 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# alex-vscode
[![npm version](https://img.shields.io/npm/v/alex-vscode.svg)](https://www.npmjs.com/package/alex-vscode)
[![Build Status](https://travis-ci.com/shinnn/alex-vscode.svg?branch=master)](https://travis-ci.com/shinnn/alex-vscode)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/alex-vscode.svg)](https://coveralls.io/github/shinnn/alex-vscode)[alex](https://alexjs.com) wrapper to easily integrate with [Visual Studio Code](https://code.visualstudio.com/) language server
```javascript
const alexVSCode = require('alex-vscode');
const {TextDocuments, createConnection} = require('vscode-languageserver');const connection = createConnection(process.stdin, process.stdout);
const documents = new TextDocuments();documents.onDidChangeContent(event => {
event.document.getText(); //=> 'He is a video game maniac.'
event.document.uri; //=> 'file:///Users/user/foo.txt'alexVSCode({event.document});
/* =>
[
{
message: '`He` may be insensitive, use `They`, `It` instead',
range: {
start: {
character: 0,
line: 0
},
end: {
character: 2,
line: 0
}
},
severity: 2
},
{
message: '`maniac` may be insensitive, use `fanatic`, `zealot`, `enthusiast` instead',
range: {
end: {
character: 25,
line: 0
},
start: {
character: 19,
line: 0
}
},
severity: 1
}
]
*/
});documents.listen(connection);
connection.listen();
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install alex-vscode
```## API
```javascript
const alexVSCode = require('alex-vscode');
```### alexVSCode(*textDocument*)
*textDocument*: [`TextDocument`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#TextDocument)
Return: `Array` ([VS Code](https://github.com/microsoft/vscode) [Diagnostic](https://github.com/Microsoft/vscode-languageserver-node/blob/release/types/3.13.0/types/src/main.ts#L452)s)It checks a given document with [alex](https://github.com/get-alex/alex) and returns warnings as an array of [Visual Studio Code](https://code.visualstudio.com/docs/extensionAPI/vscode-api) compatible [diagnostic](https://code.visualstudio.com/docs/extensionAPI/vscode-api#Diagnostic) objects.
When the document is a [markdown](https://daringfireball.net/projects/markdown/syntax) file, it [parses the text as markdown](https://github.com/get-alex/alex#alexmarkdownvalue-allow).
```javascript
document.getText(); //=> '```\nHe is a video game maniac.\n```\n'
document.uri; //=> 'file:///Users/user/foo.markdown'alexVSCode(document); //=> []
```## License
Copyright (c) 2015 - 2018 [Shinnosuke Watanabe](https://github.com/shinnn)
Licensed under [the MIT License](./LICENSE).