Skip to content

Commit

Permalink
fix: add diagnostic start and end position
Browse files Browse the repository at this point in the history
  • Loading branch information
schoero committed Jun 23, 2024
1 parent 7a5bec1 commit cc6fc1a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.2.11",
"version": "0.2.12",
"type": "module",
"name": "unwritten",
"description": "unwritten is a cli tool that auto generates documentation from your JavaScript or TypeScript project by utilizing TSDoc or JSDoc comments.",
Expand Down
6 changes: 5 additions & 1 deletion src/compiler/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ export function convertDiagnostics(ctx: DefaultContext, diagnostics: readonly Di
column: diagnostic.file && diagnostic.start
? getColumnFromPosition(ctx, diagnostic.file, diagnostic.start)
: undefined,
end: diagnostic.start && diagnostic.length
? diagnostic.start + diagnostic.length
: undefined,
line: diagnostic.file && diagnostic.start
? getLineFromPosition(ctx, diagnostic.file, diagnostic.start)
: undefined,
message: convertDiagnosticMessageTextToString(ctx, diagnostic.messageText),
path: diagnostic.file?.fileName,
severity: diagnostic.category === ctx.dependencies.ts.DiagnosticCategory.Error
? DiagnosticSeverity.Error
: DiagnosticSeverity.Warning
: DiagnosticSeverity.Warning,
start: diagnostic.start
};
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/type-definitions/unwritten.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export interface DiagnosticMessage {
message: string;
severity: DiagnosticSeverity;
column?: number;
end?: number;
line?: number;
path?: string;
start?: number;
}

export interface UnwrittenOutput {
Expand Down

0 comments on commit cc6fc1a

Please sign in to comment.