Skip to content

Commit

Permalink
fix(diagnostic): hide warnings until .wikilintrc.json
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsd-harry committed Nov 29, 2024
1 parent b020061 commit 54602c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node_modules/
dist/
/.vscode/
/.vscodeignore
# /.vscodeignore
/.eslintcache*
/page.wiki
/personal_access_token
Expand Down
9 changes: 9 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/*.wiki
personal_access_token
.vscode/
.github/
.git/
**/src/
**/tsconfig.json
.eslintcache*
.gitignore
21 changes: 11 additions & 10 deletions server/src/diagnostic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ import type {

export const diagnose = async ({textDocument: {uri}}: DocumentDiagnosticParams): Promise<Diagnostic[]> => {
const root = await parse(uri);
return root.lint().map(({startLine, startCol, endLine, endCol, severity, message, fix}) => ({
range: {
start: {line: startLine, character: startCol},
end: {line: endLine, character: endCol},
},
severity: severity === 'error' ? 1 : 2,
source: 'WikiLint',
message,
data: fix && {range: createRange(root, ...fix.range), newText: fix.text} as TextEdit,
}));
return root.lint().filter(({severity, rule}) => severity === 'error' && rule !== 'no-arg')
.map(({startLine, startCol, endLine, endCol, severity, message, fix}) => ({
range: {
start: {line: startLine, character: startCol},
end: {line: endLine, character: endCol},
},
severity: severity === 'error' ? 1 : 2,
source: 'WikiLint',
message,
data: fix && {range: createRange(root, ...fix.range), newText: fix.text} as TextEdit,
}));
};

export const quickFix = ({context: {diagnostics}, textDocument: {uri}}: CodeActionParams): CodeAction[] =>
Expand Down

0 comments on commit 54602c8

Please sign in to comment.