Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@databutton/codemirror-languageserver

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@databutton/codemirror-languageserver - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

9

dist/index.d.ts

@@ -34,3 +34,3 @@ import { EditorView, Tooltip, ViewUpdate, PluginValue } from "@codemirror/view";

textDocumentFormatting(params: LSP.DocumentFormattingParams): Promise<LSP.TextEdit[]>;
textDocumentDiagnostic(params: LSP.DocumentDiagnosticParams): Promise<LSP.DocumentDiagnosticReport>;
textDocumentLinting(params: LSP.DidChangeTextDocumentParams): Promise<PublishDiagnosticsParams>;
textDocumentHover(params: LSP.HoverParams): Promise<LSP.Hover>;

@@ -62,3 +62,8 @@ textDocumentCompletion(params: LSP.CompletionParams): Promise<LSP.CompletionList | LSP.CompletionItem[]>;

format(): Promise<void>;
requestDiagnostics(_view: EditorView): Promise<any[]>;
requestDiagnostics(view: EditorView): Promise<{
from: number;
to: number;
severity: "error" | "warning" | "info";
message: string;
}[]>;
requestHoverTooltip(view: EditorView, { line, character }: {

@@ -65,0 +70,0 @@ line: number;

@@ -124,4 +124,4 @@ import { autocompletion } from '@codemirror/autocomplete';

}
async textDocumentDiagnostic(params) {
return this.request("textDocument/diagnostic", params, timeout);
async textDocumentLinting(params) {
return this.request("textDocument/didChange", params, timeout);
}

@@ -249,3 +249,3 @@ async textDocumentHover(params) {

}
async requestDiagnostics(_view) {
async requestDiagnostics(view) {
console.debug(`Requesting diagnostics for ${this.documentUri}`);

@@ -255,41 +255,38 @@ if (!this.client.ready) {

}
const result = await this.client.textDocumentDiagnostic({
const result = await this.client.textDocumentLinting({
textDocument: {
uri: this.documentUri,
version: this.documentVersion++,
},
contentChanges: [{ text: view.state.doc.toString() }],
});
console.debug(`Diagnostics for ${this.documentUri}:`, result);
return [];
// if (result.uri !== this.documentUri) return;
// const diagnostics = result.diagnostics
// .map(({ range, message, severity }) => ({
// from: posToOffset(this.view.state.doc, range.start),
// to: posToOffset(this.view.state.doc, range.end),
// severity: (
// {
// [DiagnosticSeverity.Error]: "error",
// [DiagnosticSeverity.Warning]: "warning",
// [DiagnosticSeverity.Information]: "info",
// [DiagnosticSeverity.Hint]: "info",
// } as const
// )[severity],
// message,
// }))
// .filter(
// ({ from, to }) =>
// from !== null &&
// to !== null &&
// from !== undefined &&
// to !== undefined,
// )
// .sort((a, b) => {
// switch (true) {
// case a.from < b.from:
// return -1;
// case a.from > b.from:
// return 1;
// }
// return 0;
// });
// return diagnostics;
if (result.uri !== this.documentUri)
return;
const diagnostics = result.diagnostics
.map(({ range, message, severity }) => ({
from: posToOffset(this.view.state.doc, range.start),
to: posToOffset(this.view.state.doc, range.end),
severity: {
[DiagnosticSeverity.Error]: "error",
[DiagnosticSeverity.Warning]: "warning",
[DiagnosticSeverity.Information]: "info",
[DiagnosticSeverity.Hint]: "info",
}[severity],
message,
}))
.filter(({ from, to }) => from !== null &&
to !== null &&
from !== undefined &&
to !== undefined)
.sort((a, b) => {
switch (true) {
case a.from < b.from:
return -1;
case a.from > b.from:
return 1;
}
return 0;
});
return diagnostics;
}

@@ -305,4 +302,5 @@ async requestHoverTooltip(view, { line, character }) {

});
if (!result)
if (!result.contents) {
return null;
}
const { contents, range } = result;

@@ -309,0 +307,0 @@ let pos = posToOffset(view.state.doc, { line, character });

{
"name": "@databutton/codemirror-languageserver",
"version": "1.0.8",
"version": "1.0.9",
"description": "Language Server Plugin for CodeMirror 6",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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