Skip to content

Commit 6e585a5

Browse files
authored
Add support for vfile message notes
Closes GH-26. Closes GH-28. Reviewed-by: Christian Murphy <[email protected]> Reviewed-by: Titus Wormer <[email protected]>
1 parent 723ceba commit 6e585a5

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

lib/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ function vfileMessageToDiagnostic(message) {
128128
}
129129
}
130130

131+
if (message.note) {
132+
diagnostic.message += '\n' + message.note
133+
}
134+
131135
return diagnostic
132136
}
133137

test/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ test('`textDocument/didOpen`, `textDocument/didClose` (and diagnostics)', async
248248
range: {start: {line: 0, character: 0}, end: {line: 0, character: 0}},
249249
message: 'nothing',
250250
severity: 2
251+
},
252+
{
253+
range: {start: {line: 0, character: 0}, end: {line: 0, character: 0}},
254+
message: 'note\nThese are some additional notes',
255+
severity: 2
251256
}
252257
],
253258
'should emit diagnostics on `textDocument/didOpen`'

test/lots-of-warnings.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@ export default function lotsOfWarnings() {
3030
})
3131
file.message('point', {line: 2, column: 3})
3232
file.message('nothing')
33+
Object.assign(file.message('note'), {
34+
note: 'These are some additional notes'
35+
})
3336
}
3437
}

0 commit comments

Comments
 (0)