import { ILinterConfigHandler , PackageLinterConfigHandler , Severity } from "ui5plugin-linter" ; import { JSLinters , XMLLinters , PropertiesLinters } from "ui5plugin-linter/dist/classes/Linter" ; import { TextDocument } from "ui5plugin-parser" ; import { UI5Plugin } from "../../../UI5Plugin" ; import * as vscode from "vscode" ; import path = require ( "path" ) ; import { JSLinterException } from "ui5plugin-linter/dist/classes/config/ILinterConfigHandler" ; export class VSCodeLinterConfigHandler implements ILinterConfigHandler { private readonly _packageLinterConfigHandler : PackageLinterConfigHandler ; constructor ( ) { const currentDocumentFilePath = vscode . window . activeTextEditor ?. document . fileName ; const className = currentDocumentFilePath && UI5Plugin . getInstance ( ) . parser . fileReader . getClassNameFromPath ( currentDocumentFilePath ) ; const manifest = className && UI5Plugin . getInstance ( ) . parser . fileReader . getManifestForClass ( className ) ; let packagePath ; if ( manifest ) { const dirname = path . dirname ( manifest . fsPath ) ; packagePath = path . join ( dirname , "/package.json" ) ; } this . _packageLinterConfigHandler = new PackageLinterConfigHandler ( UI5Plugin . getInstance ( ) . parser , packagePath ) ; } getJSLinterExceptions ( ) { return this . _packageLinterConfigHandler . getJSLinterExceptions ( ) ; } getSeverity ( linter ) { return this . _packageLinterConfigHandler . getSeverity ( linter ) ; } checkIfMemberIsException ( className , memberName ) { return this . _packageLinterConfigHandler . checkIfMemberIsException ( className , memberName ) ; } getLinterUsage ( linter ) { return this . _packageLinterConfigHandler . getLinterUsage ( linter ) ; } getIfLintingShouldBeSkipped ( document ) { return this . _packageLinterConfigHandler . getIfLintingShouldBeSkipped ( document ) ; } }