Skip to content

Commit

Permalink
fix: avoid errors when occurred if diagnostic position is unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsn committed Feb 4, 2018
1 parent 2cdc421 commit e482f9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/language-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class LanguageService {
return allDiagnostics.map(diagnostic => {
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')

if (diagnostic.file) {
if (diagnostic.file && diagnostic.start) {
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start)
return `[${line + 1},${character + 1}] ${message}`
}
Expand Down

0 comments on commit e482f9f

Please sign in to comment.