Skip to content

Commit

Permalink
Merge pull request #15 from dendy/master
Browse files Browse the repository at this point in the history
Omit Diagnostic.code if it is null
  • Loading branch information
nishtahir authored Oct 18, 2018
2 parents eea60f7 + 03e3fa3 commit 442897f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import { IConnection, TextDocument, TextDocuments, InitializeResult, createConnection } from 'vscode-languageserver';
import { IConnection, TextDocument, TextDocuments, TextDocumentPositionParams, CompletionItem, InitializeResult, createConnection } from 'vscode-languageserver';
import validateDocument from './validateDocument';

export function createServer() {
Expand All @@ -19,6 +19,12 @@ export function createServer() {

connection.onDidChangeConfiguration(() => documents.all().forEach(validate));

connection.onCompletion(
(_textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
return [];
}
);

return {
capabilities: {
textDocumentSync: documents.syncKind
Expand Down
4 changes: 3 additions & 1 deletion src/validateDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ function makeDiagnostic(problem: Problem): Diagnostic {
startChar = Math.max(0, problem.column - 1),
endLine = problem.endLine != null ? Math.max(0, problem.endLine - 1) : startLine,
endChar = problem.endColumn != null ? Math.max(0, problem.endColumn - 1) : startChar;

const code = (problem.ruleId != null) ? problem.ruleId : undefined

return {
message: message,
Expand All @@ -65,7 +67,7 @@ function makeDiagnostic(problem: Problem): Diagnostic {
start: { line: startLine, character: startChar },
end: { line: endLine, character: endChar }
},
code: problem.ruleId
code: code
};
}

Expand Down

0 comments on commit 442897f

Please sign in to comment.