How to use the vscode-uri.default function in vscode-uri

To help you get started, we’ve selected a few vscode-uri examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ics-creative / project-japanese-proofreading / src / server.ts View on Github external
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;
github microsoft / vscode-json-languageservice / gulpfile.js View on Github external
/*---------------------------------------------------------------------------------------------
 *  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));
}
github liwangqian / LuaCoderAssist / server / providers / lib / linters.js View on Github external
'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 {
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / lg-language-server / lib / server.js View on Github external
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()
      );
    }
  }
github christianvoigt / argdown / packages / argdown-language-server / dist / server.js View on Github external
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* () {
github christianvoigt / argdown / packages / argdown-language-server / dist / server.js View on Github external
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* () {
github APerricone / harbourCodeExtension / server / src / main.js View on Github external
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;
github liwangqian / LuaCoderAssist / server / preload.js View on Github external
'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) {
github redhat-developer / yaml-language-server / out / server / node_modules / vscode-json-languageservice / lib / services / jsonSchemaService.js View on Github external
function toDisplayString(url) {
        try {
            var uri = vscode_uri_1.default.parse(url);
            if (uri.scheme === 'file') {
                return uri.fsPath;
            }
        }
        catch (e) {
        }
        return url;
    }
});
github liwangqian / LuaCoderAssist / server / coder.js View on Github external
'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');