[mod] reorg bundles
This commit is contained in:
parent
c875f70fb4
commit
5ffd6c7630
14 changed files with 611 additions and 199 deletions
|
|
@ -72,8 +72,9 @@
|
|||
</div>
|
||||
|
||||
<div class="col flex-grow-1" style="overflow: auto;">
|
||||
<div >
|
||||
|
||||
<div class="navbar py-0 bg-light">
|
||||
|
||||
<div class="btn-group mr-2" role="group" aria-label="First group">
|
||||
<label for="file">File:</label>
|
||||
<input id="iFile" type="url" value="file:///some/file.xqm" />
|
||||
<select id="language">
|
||||
|
|
@ -83,13 +84,7 @@
|
|||
<option value="xml">xml</option>
|
||||
</select>
|
||||
<label for="symbols">Symbols:</label><select id="symbols" disabled="disabled"></select>
|
||||
|
||||
<!-- <div class="btn-group mr-2" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-secondary">1</button>
|
||||
<button type="button" class="btn btn-secondary">2</button>
|
||||
<button type="button" class="btn btn-secondary">3</button>
|
||||
<button type="button" class="btn btn-secondary">4</button>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm " role="group" aria-label="Second group">
|
||||
<button id="search" type="button" class="btn btn-light"><i class="bi bi-search"></i></button>
|
||||
<button id="lint" type="button" class="btn btn-light"><i class="bi bi-info-square"></i></button>
|
||||
|
|
@ -98,7 +93,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="Third group">
|
||||
<button type="button" class="btn btn-light" title="Format"><i
|
||||
<button id="format" type="button" class="btn btn-light" title="Format"><i
|
||||
class="bi bi-justify-left"></i></button>
|
||||
|
||||
<button type="button" class="btn btn-light" popovertarget="popSettings" title="Settings">
|
||||
|
|
|
|||
|
|
@ -27524,80 +27524,6 @@ ${text}</tr>
|
|||
return line.from + pos.character;
|
||||
}
|
||||
|
||||
const lspTheme = /*@__PURE__*/EditorView.baseTheme({
|
||||
".cm-lsp-documentation": {
|
||||
padding: "0 7px",
|
||||
"& p, & pre": {
|
||||
margin: "2px 0"
|
||||
}
|
||||
},
|
||||
".cm-lsp-signature-tooltip": {
|
||||
padding: "2px 6px",
|
||||
borderRadius: "2.5px",
|
||||
position: "relative",
|
||||
maxWidth: "30em",
|
||||
maxHeight: "10em",
|
||||
overflowY: "scroll",
|
||||
"& .cm-lsp-documentation": {
|
||||
padding: "0",
|
||||
fontSize: "80%",
|
||||
},
|
||||
"& .cm-lsp-signature-num": {
|
||||
fontFamily: "monospace",
|
||||
position: "absolute",
|
||||
left: "2px", top: "4px",
|
||||
fontSize: "70%",
|
||||
lineHeight: "1.3"
|
||||
},
|
||||
"& .cm-lsp-signature": {
|
||||
fontFamily: "monospace",
|
||||
textIndent: "1em hanging",
|
||||
},
|
||||
"& .cm-lsp-active-parameter": {
|
||||
fontWeight: "bold"
|
||||
},
|
||||
},
|
||||
".cm-lsp-signature-multiple": {
|
||||
paddingLeft: "1.5em"
|
||||
},
|
||||
".cm-panel.cm-lsp-rename-panel": {
|
||||
padding: "2px 6px 4px",
|
||||
position: "relative",
|
||||
"& label": { fontSize: "80%" },
|
||||
"& [name=close]": {
|
||||
position: "absolute",
|
||||
top: "0", bottom: "0",
|
||||
right: "4px",
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
font: "inherit",
|
||||
padding: "0"
|
||||
}
|
||||
},
|
||||
".cm-lsp-message button[type=submit]": {
|
||||
display: "block"
|
||||
},
|
||||
".cm-lsp-reference-panel": {
|
||||
fontFamily: "monospace",
|
||||
whiteSpace: "pre",
|
||||
padding: "3px 6px",
|
||||
maxHeight: "120px",
|
||||
overflow: "auto",
|
||||
"& .cm-lsp-reference-file": {
|
||||
fontWeight: "bold",
|
||||
},
|
||||
"& .cm-lsp-reference": {
|
||||
cursor: "pointer",
|
||||
"&[aria-selected]": {
|
||||
backgroundColor: "#0077ee44"
|
||||
},
|
||||
},
|
||||
"& .cm-lsp-reference-line": {
|
||||
opacity: "0.7",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
A plugin that connects a given editor to a language server client.
|
||||
*/
|
||||
|
|
@ -27618,6 +27544,7 @@ ${text}</tr>
|
|||
languageID = lang ? lang.name : "";
|
||||
}
|
||||
client.workspace.openFile(uri, languageID, view);
|
||||
this.syncedDoc = view.state.doc;
|
||||
this.unsyncedChanges = ChangeSet.empty(view.state.doc.length);
|
||||
}
|
||||
/**
|
||||
|
|
@ -27658,6 +27585,7 @@ ${text}</tr>
|
|||
only be called by a [workspace](https://codemirror.net/6/docs/ref/#lsp-client.Workspace).
|
||||
*/
|
||||
clear() {
|
||||
this.syncedDoc = this.view.state.doc;
|
||||
this.unsyncedChanges = ChangeSet.empty(this.view.state.doc.length);
|
||||
}
|
||||
/**
|
||||
|
|
@ -27680,20 +27608,11 @@ ${text}</tr>
|
|||
return view.plugin(lspPlugin);
|
||||
}
|
||||
/**
|
||||
Create an editor extension that connects that editor to the
|
||||
given LSP client. This extension is necessary to use LSP-related
|
||||
functionality exported by this package. Creating an editor with
|
||||
this plugin will cause
|
||||
[`openFile`](https://codemirror.net/6/docs/ref/#lsp-client.Workspace.openFile) to be called on the
|
||||
workspace.
|
||||
|
||||
By default, the language ID given to the server for this file is
|
||||
derived from the editor's language configuration via
|
||||
[`Language.name`](https://codemirror.net/6/docs/ref/#language.Language.name). You can pass in
|
||||
a specific ID as a third parameter.
|
||||
Deprecated. Use
|
||||
[`LSPClient.plugin`](https://codemirror.net/6/docs/ref/#lsp-client.LSPClient.plugin) instead.
|
||||
*/
|
||||
static create(client, fileURI, languageID) {
|
||||
return [lspPlugin.of({ client, uri: fileURI, languageID }), lspTheme];
|
||||
return client.plugin(fileURI, languageID);
|
||||
}
|
||||
}
|
||||
const lspPlugin = /*@__PURE__*/ViewPlugin.fromClass(LSPPlugin);
|
||||
|
|
@ -27822,6 +27741,80 @@ ${text}</tr>
|
|||
}
|
||||
}
|
||||
|
||||
const lspTheme = /*@__PURE__*/EditorView.baseTheme({
|
||||
".cm-lsp-documentation": {
|
||||
padding: "0 7px",
|
||||
"& p, & pre": {
|
||||
margin: "2px 0"
|
||||
}
|
||||
},
|
||||
".cm-lsp-signature-tooltip": {
|
||||
padding: "2px 6px",
|
||||
borderRadius: "2.5px",
|
||||
position: "relative",
|
||||
maxWidth: "30em",
|
||||
maxHeight: "10em",
|
||||
overflowY: "scroll",
|
||||
"& .cm-lsp-documentation": {
|
||||
padding: "0",
|
||||
fontSize: "80%",
|
||||
},
|
||||
"& .cm-lsp-signature-num": {
|
||||
fontFamily: "monospace",
|
||||
position: "absolute",
|
||||
left: "2px", top: "4px",
|
||||
fontSize: "70%",
|
||||
lineHeight: "1.3"
|
||||
},
|
||||
"& .cm-lsp-signature": {
|
||||
fontFamily: "monospace",
|
||||
textIndent: "1em hanging",
|
||||
},
|
||||
"& .cm-lsp-active-parameter": {
|
||||
fontWeight: "bold"
|
||||
},
|
||||
},
|
||||
".cm-lsp-signature-multiple": {
|
||||
paddingLeft: "1.5em"
|
||||
},
|
||||
".cm-panel.cm-lsp-rename-panel": {
|
||||
padding: "2px 6px 4px",
|
||||
position: "relative",
|
||||
"& label": { fontSize: "80%" },
|
||||
"& [name=close]": {
|
||||
position: "absolute",
|
||||
top: "0", bottom: "0",
|
||||
right: "4px",
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
font: "inherit",
|
||||
padding: "0"
|
||||
}
|
||||
},
|
||||
".cm-lsp-message button[type=submit]": {
|
||||
display: "block"
|
||||
},
|
||||
".cm-lsp-reference-panel": {
|
||||
fontFamily: "monospace",
|
||||
whiteSpace: "pre",
|
||||
padding: "3px 6px",
|
||||
maxHeight: "120px",
|
||||
overflow: "auto",
|
||||
"& .cm-lsp-reference-file": {
|
||||
fontWeight: "bold",
|
||||
},
|
||||
"& .cm-lsp-reference": {
|
||||
cursor: "pointer",
|
||||
"&[aria-selected]": {
|
||||
backgroundColor: "#0077ee44"
|
||||
},
|
||||
},
|
||||
"& .cm-lsp-reference-line": {
|
||||
opacity: "0.7",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
class Request {
|
||||
constructor(id, params, timeout) {
|
||||
this.id = id;
|
||||
|
|
@ -27870,7 +27863,11 @@ ${text}</tr>
|
|||
implementation: {},
|
||||
typeDefinition: {},
|
||||
references: {},
|
||||
diagnostic: {},
|
||||
},
|
||||
window: {
|
||||
showMessage: {}
|
||||
}
|
||||
};
|
||||
/**
|
||||
A workspace mapping is used to track changes made to open
|
||||
|
|
@ -27991,10 +27988,21 @@ ${text}</tr>
|
|||
*/
|
||||
this.serverCapabilities = null;
|
||||
this.supportSync = -1;
|
||||
/**
|
||||
@internal
|
||||
*/
|
||||
this.extensions = [];
|
||||
this.receiveMessage = this.receiveMessage.bind(this);
|
||||
this.initializing = new Promise((resolve, reject) => this.init = { resolve, reject });
|
||||
this.timeout = (_a = config.timeout) !== null && _a !== void 0 ? _a : 3000;
|
||||
this.workspace = config.workspace ? config.workspace(this) : new DefaultWorkspace(this);
|
||||
if (config.extensions)
|
||||
for (let ext of config.extensions) {
|
||||
if (Array.isArray(ext) || ext.extension)
|
||||
this.extensions.push(ext);
|
||||
else if (ext.editorExtension)
|
||||
this.extensions.push(ext.editorExtension);
|
||||
}
|
||||
}
|
||||
/**
|
||||
Whether this client is connected (has a transport).
|
||||
|
|
@ -28011,11 +28019,18 @@ ${text}</tr>
|
|||
this.transport.unsubscribe(this.receiveMessage);
|
||||
this.transport = transport;
|
||||
transport.subscribe(this.receiveMessage);
|
||||
let capabilities = clientCapabilities;
|
||||
if (this.config.extensions)
|
||||
for (let ext of this.config.extensions) {
|
||||
let { clientCapabilities } = ext;
|
||||
if (clientCapabilities)
|
||||
capabilities = mergeCapabilities(capabilities, clientCapabilities);
|
||||
}
|
||||
this.requestInner("initialize", {
|
||||
processId: null,
|
||||
clientInfo: { name: "@codemirror/lsp-client" },
|
||||
rootUri: this.config.rootUri || null,
|
||||
capabilities: clientCapabilities
|
||||
capabilities
|
||||
}).promise.then(resp => {
|
||||
var _a;
|
||||
this.serverCapabilities = resp.capabilities;
|
||||
|
|
@ -28038,6 +28053,30 @@ ${text}</tr>
|
|||
this.workspace.disconnected();
|
||||
}
|
||||
/**
|
||||
Create a plugin for this client, to add to an editor
|
||||
configuration. This extension is necessary to use LSP-related
|
||||
functionality exported by this package. The returned extension
|
||||
will include the editor
|
||||
extensions included in this client's
|
||||
[configuration](https://codemirror.net/6/docs/ref/#lsp-client.LSPClientConfig.extensions).
|
||||
|
||||
Creating an editor with this plugin will cause
|
||||
[`openFile`](https://codemirror.net/6/docs/ref/#lsp-client.Workspace.openFile) to be called on the
|
||||
workspace.
|
||||
|
||||
By default, the language ID given to the server for this file is
|
||||
derived from the editor's language configuration via
|
||||
[`Language.name`](https://codemirror.net/6/docs/ref/#language.Language.name). You can pass in
|
||||
a specific ID as a third parameter.
|
||||
*/
|
||||
plugin(fileURI, languageID) {
|
||||
return [
|
||||
lspPlugin.of({ client: this, uri: fileURI, languageID }),
|
||||
lspTheme,
|
||||
this.extensions
|
||||
];
|
||||
}
|
||||
/**
|
||||
Send a `textDocument/didOpen` notification to the server.
|
||||
*/
|
||||
didOpen(file) {
|
||||
|
|
@ -28078,6 +28117,13 @@ ${text}</tr>
|
|||
let handler = (_a = this.config.notificationHandlers) === null || _a === void 0 ? void 0 : _a[value.method];
|
||||
if (handler && handler(this, value.params))
|
||||
return;
|
||||
if (this.config.extensions)
|
||||
for (let ext of this.config.extensions) {
|
||||
let { notificationHandlers } = ext;
|
||||
let handler = notificationHandlers === null || notificationHandlers === void 0 ? void 0 : notificationHandlers[value.method];
|
||||
if (handler && handler(this, value.params))
|
||||
return;
|
||||
}
|
||||
let deflt = defaultNotificationHandlers[value.method];
|
||||
if (deflt)
|
||||
deflt(this, value.params);
|
||||
|
|
@ -28214,6 +28260,20 @@ ${text}</tr>
|
|||
});
|
||||
return events.reverse();
|
||||
}
|
||||
function mergeCapabilities(base, add) {
|
||||
if (add == null)
|
||||
return base;
|
||||
if (typeof base != "object" || typeof add != "object")
|
||||
return add;
|
||||
let result = {};
|
||||
let baseProps = Object.keys(base), addProps = Object.keys(add);
|
||||
for (let prop of baseProps)
|
||||
result[prop] = addProps.indexOf(prop) > -1 ? mergeCapabilities(base[prop], add[prop]) : base[prop];
|
||||
for (let prop of addProps)
|
||||
if (baseProps.indexOf(prop) < 0)
|
||||
result[prop] = add[prop];
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
Register the [language server completion
|
||||
|
|
@ -29072,11 +29132,15 @@ ${text}</tr>
|
|||
|
||||
/**
|
||||
Returns an extension that enables the [LSP
|
||||
plugin](https://codemirror.net/6/docs/ref/#lsp-client.LSPPlugin) and all other features provided by
|
||||
this package. You can also pick and choose individual extensions
|
||||
from the exports. In that case, make sure to also include
|
||||
[`LSPPlugin.create`](https://codemirror.net/6/docs/ref/#lsp-client.LSPPlugin^create) in your
|
||||
extensions, or the others will not work.
|
||||
plugin](https://codemirror.net/6/docs/ref/#lsp-client.LSPPlugin) as well as LSP based
|
||||
autocompletion, hover tooltips, and signature help, along with the
|
||||
keymaps for reformatting, renaming symbols, jumping to definition,
|
||||
and finding references.
|
||||
|
||||
This function is deprecated. Prefer to directly use
|
||||
[`LSPPlugin.create`](https://codemirror.net/6/docs/ref/#lsp-client.LSPPlugin^create) and either add
|
||||
the extensions you need directly, or configure them in the client
|
||||
via [`languageServerExtensions`](https://codemirror.net/6/docs/ref/#lsp-client.languageServerExtensions).
|
||||
*/
|
||||
function languageServerSupport(client, uri, languageID) {
|
||||
return [
|
||||
|
|
@ -29084,7 +29148,7 @@ ${text}</tr>
|
|||
serverCompletion(),
|
||||
hoverTooltips(),
|
||||
keymap.of([...formatKeymap, ...renameKeymap, ...jumpToDefinitionKeymap, ...findReferencesKeymap]),
|
||||
signatureHelp()
|
||||
signatureHelp(),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -31449,12 +31513,10 @@ ${text}</tr>
|
|||
if (update.docChanged) {
|
||||
const currentContent = update.state.doc.toString();
|
||||
|
||||
// Clear previous timeout
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
|
||||
// Set new timeout
|
||||
timeoutId = setTimeout(() => {
|
||||
if (currentContent !== lastContent) {
|
||||
lastContent = currentContent;
|
||||
|
|
@ -31464,6 +31526,18 @@ ${text}</tr>
|
|||
}
|
||||
});
|
||||
}
|
||||
function listCommands(view) {
|
||||
const commands = new Map();
|
||||
const keymaps = view.state.facet(keymap);
|
||||
for (let km of keymaps) {
|
||||
for (let binding of km) {
|
||||
if (binding.run && binding.run.name ) {
|
||||
commands.set(binding.run.name ,{key:binding.key,fn:binding.run});
|
||||
}
|
||||
}
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
|
||||
exports.LSPClient = LSPClient;
|
||||
exports.LSPPlugin = LSPPlugin;
|
||||
|
|
@ -31473,6 +31547,7 @@ ${text}</tr>
|
|||
exports.debouncedChangeListener = debouncedChangeListener;
|
||||
exports.languageServerSupport = languageServerSupport;
|
||||
exports.linter = linter;
|
||||
exports.listCommands = listCommands;
|
||||
exports.openLintPanel = openLintPanel;
|
||||
exports.openSearchPanel = openSearchPanel;
|
||||
exports.setDiagnostics = setDiagnostics;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -22,9 +22,11 @@ document.getElementById("connect").onclick = e => {
|
|||
e.preventDefault()
|
||||
connect()
|
||||
};
|
||||
document.getElementById("search").onclick = e => {
|
||||
lsp.openSearchPanel(view);
|
||||
};
|
||||
|
||||
$("search").onclick = e => lsp.openSearchPanel(view);
|
||||
|
||||
$("format").onclick = e => console.log("CMDS",lsp.listCommands(view));
|
||||
|
||||
document.getElementById("lint").onclick = async e => {
|
||||
console.log("word", view.state.wordAt(1));
|
||||
const ser = document.getElementById("iServer").value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue