New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@volar/language-server

Package Overview
Dependencies
Maintainers
1
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@volar/language-server - npm Package Compare versions

Comparing version 1.1.0-alpha.2 to 1.2.0-alpha.1

6

out/common/project.d.ts
import * as embedded from '@volar/language-core';
import * as embeddedLS from '@volar/language-service';
import { LanguageServiceConfig } from '@volar/language-service';
import * as path from 'typesafe-path';

@@ -7,3 +8,2 @@ import type * as ts from 'typescript/lib/tsserverlibrary';

import { WorkspaceContext } from './workspace';
import { ServerConfig } from './utils/serverConfig';
export interface ProjectContext {

@@ -14,7 +14,7 @@ workspace: WorkspaceContext;

documentRegistry: ts.DocumentRegistry | undefined;
serverConfig: ServerConfig | undefined;
serverConfig: LanguageServiceConfig | undefined;
}
export type Project = ReturnType<typeof createProject>;
export declare function createProject(context: ProjectContext): Promise<{
tsConfig: path.PosixPath | ts.CompilerOptions;
tsConfig: ts.CompilerOptions | path.PosixPath;
scripts: {

@@ -21,0 +21,0 @@ clear: () => void;

@@ -12,3 +12,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

exports.createProject = void 0;
const embedded = require("@volar/language-core");
const embeddedLS = require("@volar/language-service");

@@ -67,33 +66,33 @@ const shared = require("@volar/shared");

function getLanguageService() {
var _a, _b, _c, _d, _e, _f;
if (!languageService) {
const languageModules = context.workspace.workspaces.plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.getLanguageModules) === null || _a === void 0 ? void 0 : _a.call(plugin, languageServiceHost)) !== null && _b !== void 0 ? _b : []; }).flat();
const languageContext = embedded.createLanguageContext(languageServiceHost, languageModules);
const languageServiceContext = embeddedLS.createLanguageServiceContext({
const config = {
languages: Object.assign({}, (_b = (_a = context.serverConfig) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : {}),
plugins: Object.assign({}, (_d = (_c = context.serverConfig) === null || _c === void 0 ? void 0 : _c.plugins) !== null && _d !== void 0 ? _d : {}),
rules: Object.assign({}, (_e = context.serverConfig) === null || _e === void 0 ? void 0 : _e.rules),
};
const env = {
rootUri: context.rootUri,
configurationHost: context.workspace.workspaces.configurationHost,
fileSystemProvider: context.workspace.workspaces.server.runtimeEnv.fileSystemProvide,
documentContext: getDocumentContext(context.workspace.workspaces.ts, languageServiceHost, context.rootUri.toString()),
schemaRequestService: (uri) => __awaiter(this, void 0, void 0, function* () {
const protocol = uri.substring(0, uri.indexOf(':'));
const builtInHandler = context.workspace.workspaces.server.runtimeEnv.schemaRequestHandlers[protocol];
if (builtInHandler) {
return yield builtInHandler(uri);
}
return '';
}),
};
const lsCtx = {
project: context,
env,
sys,
host: languageServiceHost,
context: languageContext,
getPlugins() {
var _a, _b;
return [
...(_b = (_a = context.serverConfig) === null || _a === void 0 ? void 0 : _a.plugins) !== null && _b !== void 0 ? _b : [],
...context.workspace.workspaces.plugins.map(plugin => { var _a, _b; return (_b = (_a = plugin.getLanguageServicePlugins) === null || _a === void 0 ? void 0 : _a.call(plugin, languageServiceHost, languageServiceContext)) !== null && _b !== void 0 ? _b : []; }).flat(),
];
},
env: {
rootUri: context.rootUri,
configurationHost: context.workspace.workspaces.configurationHost,
fileSystemProvider: context.workspace.workspaces.server.runtimeEnv.fileSystemProvide,
documentContext: getDocumentContext(context.workspace.workspaces.ts, languageServiceHost, context.rootUri.toString()),
schemaRequestService: (uri) => __awaiter(this, void 0, void 0, function* () {
const protocol = uri.substring(0, uri.indexOf(':'));
const builtInHandler = context.workspace.workspaces.server.runtimeEnv.schemaRequestHandlers[protocol];
if (builtInHandler) {
return yield builtInHandler(uri);
}
return '';
}),
},
documentRegistry: context.documentRegistry,
getLanguageService: () => languageService,
});
languageService = embeddedLS.createLanguageService(languageServiceContext);
};
for (const plugin of context.workspace.workspaces.plugins) {
(_f = plugin.resolveConfig) === null || _f === void 0 ? void 0 : _f.call(plugin, config, lsCtx);
}
languageService = embeddedLS.createLanguageService(languageServiceHost, config, env, context.documentRegistry);
}

@@ -189,7 +188,2 @@ return languageService;

}
for (const plugin of context.workspace.workspaces.plugins) {
if (context.workspace.workspaces.ts && plugin.resolveLanguageServiceHost) {
host = plugin.resolveLanguageServiceHost(context.workspace.workspaces.ts, sys, context.tsConfig, host);
}
}
return host;

@@ -196,0 +190,0 @@ function getScriptVersion(fileName) {

@@ -1,5 +0,2 @@

import { LanguageServicePlugin } from '@volar/language-service';
export interface ServerConfig {
plugins?: LanguageServicePlugin[];
}
export declare function loadServerConfig(dir: string, configFile: string | undefined): ServerConfig | undefined;
import { LanguageServiceConfig } from "@volar/language-service";
export declare function loadConfig(dir: string, configFile: string | undefined): LanguageServiceConfig | undefined;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadServerConfig = void 0;
function loadServerConfig(dir, configFile) {
exports.loadConfig = void 0;
function loadConfig(dir, configFile) {
let configPath;

@@ -20,3 +20,3 @@ try {

}
exports.loadServerConfig = loadServerConfig;
exports.loadConfig = loadConfig;
//# sourceMappingURL=serverConfig.js.map

@@ -26,3 +26,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

let inferredProject;
const serverConfig = (0, serverConfig_1.loadServerConfig)(shared.uriToFileName(context.rootUri.toString()), context.workspaces.initOptions.configFilePath);
const serverConfig = (0, serverConfig_1.loadConfig)(shared.uriToFileName(context.rootUri.toString()), context.workspaces.initOptions.configFilePath);
const sys = (_a = context.workspaces.fileSystemHost) === null || _a === void 0 ? void 0 : _a.getWorkspaceFileSystem(context.rootUri);

@@ -29,0 +29,0 @@ const documentRegistry = sys ? (_b = context.workspaces.ts) === null || _b === void 0 ? void 0 : _b.createDocumentRegistry(sys.useCaseSensitiveFileNames, shared.uriToFileName(context.rootUri.toString())) : undefined;

@@ -8,3 +8,4 @@ /// <reference types="node" />

import { URI } from 'vscode-uri';
import { LanguageServiceRuntimeContext } from '@volar/language-service';
import { LanguageServiceConfig, LanguageServiceRuntimeContext } from '@volar/language-service';
import { ProjectContext } from './common/project';
export type FileSystemHost = {

@@ -30,3 +31,9 @@ ready(connection: vscode.Connection): void;

}
export type LanguageServerPlugin<A extends LanguageServerInitializationOptions = LanguageServerInitializationOptions, B extends embedded.LanguageServiceHost = embedded.LanguageServiceHost, C = embeddedLS.LanguageService> = (initOptions: A) => {
export interface LanguageServiceContext {
project: ProjectContext;
env: LanguageServiceRuntimeContext['env'];
host: embedded.LanguageServiceHost;
sys: FileSystem;
}
export type LanguageServerPlugin<A extends LanguageServerInitializationOptions = LanguageServerInitializationOptions, C = embeddedLS.LanguageService> = (initOptions: A) => {
tsconfigExtraFileExtensions: ts.FileExtensionInfo[];

@@ -38,5 +45,3 @@ diagnosticDocumentSelector: vscode.DocumentSelector;

};
resolveLanguageServiceHost?(ts: typeof import('typescript/lib/tsserverlibrary'), sys: FileSystem, tsConfig: string | ts.CompilerOptions, host: embedded.LanguageServiceHost): B;
getLanguageModules?(host: B): embedded.LanguageModule[];
getLanguageServicePlugins?(host: B, context: LanguageServiceRuntimeContext): embeddedLS.LanguageServicePlugin[];
resolveConfig?(config: LanguageServiceConfig, ctx: LanguageServiceContext): void;
onInitialize?(_: vscode.InitializeResult): void;

@@ -43,0 +48,0 @@ onInitialized?(getLanguageService: (uri: string) => Promise<C>): void;

{
"name": "@volar/language-server",
"version": "1.1.0-alpha.2",
"version": "1.2.0-alpha.1",
"main": "out/index.js",

@@ -20,5 +20,5 @@ "license": "MIT",

"dependencies": {
"@volar/language-core": "1.1.0-alpha.2",
"@volar/language-service": "1.1.0-alpha.2",
"@volar/shared": "1.1.0-alpha.2",
"@volar/language-core": "1.2.0-alpha.1",
"@volar/language-service": "1.2.0-alpha.1",
"@volar/shared": "1.2.0-alpha.1",
"@vscode/l10n": "^0.0.10",

@@ -33,3 +33,3 @@ "request-light": "^0.6.0",

},
"gitHead": "2a5ff13854187a26c1b5e36c5eab8b94cbd08375"
"gitHead": "08f0fd7c8a0ac7ba92de978c3ee7338d1919ebd7"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc