diff --git a/src/check_datapack.ts b/src/check_datapack.ts index 5605388..adf1cbd 100644 --- a/src/check_datapack.ts +++ b/src/check_datapack.ts @@ -125,26 +125,27 @@ export class CustomService extends core.Service { } } - async checkFile(path: string, lang: string): Promise { - const url = this.makeFileUrl(path) - const content = this.getFileContent(path) + async checkFile(filePath: string, lang: string): Promise { + const url = this.makeFileUrl(filePath) + const content = this.getFileContent(filePath) this.project.onDidOpen(url, lang, 0, content) const docAndNode = this.project.getClientManaged(url) if (!docAndNode) { - action.error(`File ${path} is not loaded`) + action.error(`File ${filePath} is not loaded`) return false } const { node } = docAndNode const errors = core.FileNode.getErrors(node) if (errors.length !== 0) { - const msg = `${errors.length} error${errors.length > 1 ? "s" : ""} in ${path}` + const relPath = path.relative(this.rootDir, filePath) + const msg = `${errors.length} error${errors.length > 1 ? "s" : ""} in ${relPath}` if (this.options.verbose) { action.startGroup(msg) for (const err of errors) { action.error( err.message, - this.getErrorProperties(err, path, content) + this.getErrorProperties(err, filePath, content) ) } action.endGroup()