Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function validateTextDocument(textDocument: TextDocument): Promise {
// In this simple example we get the settings for every validate run.
const settings = await getDocumentSettings(textDocument.uri);
const document = textDocument.getText();
const ext: string = path.extname(
vscode_uri.default.parse(textDocument.uri).fsPath,
);
const engine: TextLintEngine = new TextLintEngine({
configFile: path.resolve(__dirname, "../.textlintrc"),
});
const results: TextlintResult[] = await engine.executeOnText(document, ext);
const diagnostics: Diagnostic[] = [];
if (engine.isErrorResults(results)) {
const messages: TextlintMessage[] = results[0].messages;
const l: number = messages.length;
for (let i: number = 0; i < l; i++) {
const message: TextlintMessage = messages[i];
const text: string = message.message;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var gulp = require('gulp');
var tsb = require('gulp-tsb');
var assign = require('object-assign');
var rimraf = require('rimraf');
var merge = require('merge-stream');
var path = require('path');
var uri = require('vscode-uri').default;
var options = require('./src/tsconfig.json').compilerOptions;
var outDir = './lib';
// set sourceRoot to an absolute location to workaround https://github.com/jrieken/gulp-tsb/issues/48
var sourceRoot = uri.file(path.join(__dirname, 'src')).toString();
var compilation = tsb.create(assign({ verbose: true, sourceRoot: sourceRoot }, options));
var tsSources = './src/**/*.ts';
function compileTask() {
return merge(
gulp.src(tsSources).pipe(compilation())
)
.pipe(gulp.dest(outDir));
}
'use strict';
const engine = require('../../lib/engine');
const uri_1 = require('vscode-uri').default;
const langserver_1 = require('vscode-languageserver');
const path_1 = require('path');
const fs_1 = require('fs');
// default to 64-bit windows luacheck.exe, from https://github.com/mpeterv/luacheck/releases
const default_luacheck_executor = path_1.resolve(__dirname, '../../../3rd/luacheck/luacheck.exe');
const luacheck_regex = /^(.+):(\d+):(\d+)-(\d+): \(([EW])(\d+)\) (.+)$/;
const defaultOpt = ['--no-color', '--codes', '--ranges', '--formatter', 'plain'];
function isFileSync(aPath) {
try {
return fs_1.statSync(aPath).isFile();
} catch (e) {
if (e.code === 'ENOENT') {
return false;
} else {
async resovleSchema(url) {
const uri = vscode_uri_1.default.parse(url);
if (uri.scheme === 'file') {
return new Promise((resolve, reject) => {
fs.readFile(uri.fsPath, 'UTF-8', (err, result) => {
err ? reject('') : resolve(result.toString());
});
});
}
try {
const response = await request_light_1.xhr({ url, followRedirects: 5 });
return response.responseText;
} catch (error) {
return Promise.reject(
error.responseText || request_light_1.getErrorStatusDescription(error.status) || error.toString()
);
}
}
const processDocForProviders = (textDocument) => __awaiter(this, void 0, void 0, function* () {
const doc = documents.get(textDocument.uri);
const text = doc.getText();
const path = vscode_uri_1.default.parse(textDocument.uri).fsPath;
return yield processTextForProviders(text, path);
});
const processTextForProviders = (text, path) => __awaiter(this, void 0, void 0, function* () {
connection.onWorkspaceSymbol((params) => __awaiter(this, void 0, void 0, function* () {
const workspaceSymbols = [];
const query = params.query;
for (var workspaceFolder of workspaceFolders) {
const rootPath = vscode_uri_1.default.parse(workspaceFolder.uri).fsPath;
const inputPath = rootPath + "/**/*.{ad,argdown}";
const request = {
inputPath,
process: ["parse-input", "build-model", "add-document-symbols"]
};
const responses = yield node_1.argdown.load(request);
const folderSymbols = responses
.map(r => r.documentSymbols)
.reduce((acc, val) => acc.concat(val), []);
workspaceSymbols.push(...folderSymbols);
}
return workspaceSymbols.filter(s => s && s.name.indexOf(query) !== -1);
}));
connection.onExecuteCommand((params) => __awaiter(this, void 0, void 0, function* () {
var provider = require('./provider.js');
var server = require('vscode-languageserver')
var fs = require("fs");
var path = require("path");
var Uri = require("vscode-uri").default;
var connection = server.createConnection(
new server.IPCMessageReader(process),
new server.IPCMessageWriter(process));
/** @type {Array} */
var workspaceRoots;
/** @type {Array} */
var includeDirs;
/** @type {number} */
var workspaceDepth;
/** @type {boolean} */
var wordBasedSuggestions;
/** @type {Object.} */
var files;
'use strict';
const engine = require('./lib/engine');
const uri_1 = require('vscode-uri').default;
const awaiter = require('./providers/lib/awaiter');
const utils_1 = require('./providers/lib/utils');
const fs_1 = require('fs');
const path_1 = require('path');
const findup = require('find-up');
const STD_PRELOADS = {
'5.1': 'stdlibs/5_1.json',
'5.2': 'stdlibs/5_2.json',
'5.3': 'stdlibs/5_3.json'
}
const LOVE_PRELOAD = 'stdlibs/love.json';
const LUAJIT_PRELOAD = 'stdlibs/luajit-2_0.json';
function loadAll(coder) {
function toDisplayString(url) {
try {
var uri = vscode_uri_1.default.parse(url);
if (uri.scheme === 'file') {
return uri.fsPath;
}
}
catch (e) {
}
return url;
}
});
'use strict';
const langserver_1 = require('vscode-languageserver');
const uri_1 = require('vscode-uri').default;
const tracer_1 = require('./tracer');
const preload_1 = require('./preload');
const awaiter = require('./providers/lib/awaiter');
const file_manager_1 = require('./providers/lib/file-manager');
const symbol_provider_1 = require('./providers/symbol-provider');
const definition_provider_1 = require('./providers/definition-provider');
const completion_provider_1 = require('./providers/completion-provider');
const diagnostic_provider_1 = require('./providers/diagnostic-provider');
const hover_provider_1 = require('./providers/hover-provider');
const signature_provider = require('./providers/signature-provider');
const rename_provider = require('./providers/rename-provider');
const format_provider = require('./providers/format-provider');
const ldoc_provider = require('./providers/ldoc-provider');
const engine = require('./lib/engine');
const busted = require('./lib/busted');
const adds = require('autodetect-decoder-stream');