feat: make path in error message relative to rootDir
This commit is contained in:
@@ -125,26 +125,27 @@ export class CustomService extends core.Service {
|
||||
}
|
||||
}
|
||||
|
||||
async checkFile(path: string, lang: string): Promise<boolean> {
|
||||
const url = this.makeFileUrl(path)
|
||||
const content = this.getFileContent(path)
|
||||
async checkFile(filePath: string, lang: string): Promise<boolean> {
|
||||
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()
|
||||
|
Reference in New Issue
Block a user