Skip to content

Commit d3d1dc7

Browse files
committed
use AGLint's built-in method for rule documentation URLs
1 parent 45c6651 commit d3d1dc7

1 file changed

Lines changed: 2 additions & 18 deletions

File tree

server/src/server.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ import {
4444
import { TextDocument } from 'vscode-languageserver-textdocument';
4545

4646
import { LSPFileSystemAdapter } from './adapters/fs';
47-
import {
48-
AGLINT_REPO_URL,
49-
EMPTY,
50-
LF,
51-
SPACE,
52-
} from './common/constants';
47+
import { EMPTY, LF, SPACE } from './common/constants';
5348
import { defaultSettings, type ExtensionSettings } from './settings';
5449
import { loadAglintModule, type LoadedAglint } from './utils/aglint-loader';
5550
import { getErrorMessage, getErrorStack } from './utils/error';
@@ -211,17 +206,6 @@ const getVscodeCodeRangeFromAglintPositionRange = (range: LinterPositionRange):
211206
);
212207
};
213208

214-
/**
215-
* Get the documentation URL for the given AGLint rule.
216-
*
217-
* @param ruleId Rule ID.
218-
*
219-
* @returns Documentation URL.
220-
*/
221-
const getAglintRuleDocumentationUrl = (ruleId: string): string => {
222-
return `${AGLINT_REPO_URL}/blob/master/docs/rules/${ruleId}.md`;
223-
};
224-
225209
/**
226210
* Convert AGLint result to VSCode diagnostics.
227211
*
@@ -252,7 +236,7 @@ const getVscodeDiagnosticsFromLinterResult = (linterResult: LinterResult): Diagn
252236
if (problem.ruleId) {
253237
diagnostic.code = problem.ruleId;
254238
diagnostic.codeDescription = {
255-
href: getAglintRuleDocumentationUrl(problem.ruleId),
239+
href: aglint.linter.getAglintRuleDocumentationUrl(problem.ruleId),
256240
};
257241
}
258242

0 commit comments

Comments
 (0)