Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
///
import Engine from 'php-parser';
import files from './Filesystem';
import URI from 'vscode-uri';
import { PathLike } from 'fs';
import { TestNode, TestOptions, TestSuiteNode } from './TestNode';
import {
TextDocument,
WorkspaceFolder as _WorkspaceFolder,
} from 'vscode-languageserver';
const engine = Engine.create({
ast: {
withPositions: true,
withSource: true,
},
parser: {
php7: true,
debug: false,
extractDoc: true,
suppressErrors: true,
},
lexer: {
all_tokens: true,
comment_tokens: true,
mode_eval: true,
asp_tags: true,
short_tags: true,
public refresh(document: vscode.TextDocument): void {
this.config = vscode.workspace.getConfiguration("treeview.php");
this.tree = {} as token.ITokenTree;
if (document !== undefined) {
this.tree = this.walk(
require("php-parser").create({ ast: { withPositions: true } })
.parseCode(document.getText()).children,
);
}
}
return new Promise((resolve, reject) =>
{
var parserInst = phpParser.create({
parser: {
locations: true,
docBlocks: true,
suppressErrors: true
}
});
var ast = parserInst.parseCode(text);
parserInst = null;
this.BuildObjectTree(ast, filePath).then((tree) => {
var symbolCache = this.BuildSymbolCache(tree, filePath).then(symbolCache => {
var returnObj = {
tree: tree,
symbolCache: symbolCache
};