Package Exports
- vfile-messages-to-vscode-diagnostics
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vfile-messages-to-vscode-diagnostics) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vfile-messages-to-vscode-diagnostics
Convert VFile#messages
into an Array
of VS Code diagnostics
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
npm install vfile-messages-to-vscode-diagnostics
API
const vFileMessagesToVSCodeDiagnostics = require('vfile-messages-to-vscode-diagnostics');
vFileMessagesToVSCodeDiagnostics(messages)
messages: <Iterable<VFileMessage>>
except for string
and Map
Return: Diagnostics[]
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 © 2018 Shinnosuke Watanabe