Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/vfile-messages-to-vscode-diagnostics
Convert VFile#messages into an array of VS Code diagnostics
https://github.com/shinnn/vfile-messages-to-vscode-diagnostics
convert interface javascript nodejs vfile vscode
Last synced: 27 days ago
JSON representation
Convert VFile#messages into an array of VS Code diagnostics
- Host: GitHub
- URL: https://github.com/shinnn/vfile-messages-to-vscode-diagnostics
- Owner: shinnn
- License: isc
- Created: 2015-11-30T12:15:56.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-27T03:40:09.000Z (about 6 years ago)
- Last Synced: 2024-10-12T22:49:26.549Z (about 1 month ago)
- Topics: convert, interface, javascript, nodejs, vfile, vscode
- Language: JavaScript
- Size: 72.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vfile-messages-to-vscode-diagnostics
[![npm version](https://img.shields.io/npm/v/vfile-messages-to-vscode-diagnostics.svg)](https://www.npmjs.com/package/vfile-messages-to-vscode-diagnostics)
[![Build Status](https://travis-ci.org/shinnn/vfile-messages-to-vscode-diagnostics.svg?branch=master)](https://travis-ci.org/shinnn/vfile-messages-to-vscode-diagnostics)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/vfile-messages-to-vscode-diagnostics.svg)](https://coveralls.io/github/shinnn/vfile-messages-to-vscode-diagnostics)Convert [`VFile#messages`](https://github.com/vfile/vfile#vfilemessages) into an `Array` of [VS Code](https://code.visualstudio.com/) [diagnostic](https://github.com/Microsoft/vscode-languageserver-node/blob/release/types/3.13.0/types/src/main.ts#L452)s
```javascript
const VFile = require('vfile');
const vFileMessagesToVSCodeDiagnostics = require('vfile-messages-to-vscode-diagnostics');vFileMessagesToVSCodeDiagnostics(new VFile().message('warning!', {line: 10, column: 2}));
/* =>
[{
message: 'warning!',
severity: 2,
range: {
start: {line: 9, character: 1},
end: {line: 9, character: 1}
}
}]
*/
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```
npm install vfile-messages-to-vscode-diagnostics
```## API
```javascript
const vFileMessagesToVSCodeDiagnostics = require('vfile-messages-to-vscode-diagnostics');
```### vFileMessagesToVSCodeDiagnostics(*messages*)
*messages*: `>` except for `string` and `Map`
Return: `Diagnostics[]````javascript
const VFile = require('vfile');
const vFileMessagesToVSCodeDiagnostics = require('vfile-messages-to-vscode-diagnostics');const file = new VFile();
file.message('warning1');
file.message('warning2', {
position: {
start: {line: 23, column: 5},
end: {line: 23, column: 11}
}
});vFileMessagesToVSCodeDiagnostics(file.messages);
/* =>
[{
message: 'warning1',
severity: 2,
range: {
start: {line: 0, character: 0},
end: {line: 0, character: 0}
}
}, {
message: 'warning2',
severity: 2,
range: {
start: {line: 22, character: 4},
end: {line: 22, character: 10}
}
}]
*/
```## License
[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe