[mod] msg

This commit is contained in:
Andy Bunce 2025-10-21 22:36:26 +01:00
parent dcfc390f1e
commit 21c0eae056
7 changed files with 21 additions and 16 deletions

View file

@ -4,7 +4,7 @@ import { EditorState, StateEffect, Compartment } from '@codemirror/state';
import { import {
lineNumbers, highlightActiveLineGutter, highlightWhitespace, lineNumbers, highlightActiveLineGutter, highlightWhitespace,
drawSelection, rectangularSelection, crosshairCursor, highlightActiveLine, drawSelection, rectangularSelection, crosshairCursor, highlightActiveLine,
keymap, dropCursor, EditorView keymap, dropCursor, EditorView,tooltips
} from '@codemirror/view'; } from '@codemirror/view';
import { openSearchPanel, highlightSelectionMatches, searchKeymap } from '@codemirror/search'; import { openSearchPanel, highlightSelectionMatches, searchKeymap } from '@codemirror/search';
@ -90,7 +90,7 @@ const baseExts = [
drawSelection(), drawSelection(),
dropCursor(), dropCursor(),
EditorState.allowMultipleSelections.of(true), EditorState.allowMultipleSelections.of(true),
tooltips({ }), // clipped
keymap.of([indentWithTab]), keymap.of([indentWithTab]),
indentOnInput(), indentOnInput(),
syntaxHighlighting(defaultHighlightStyle, { fallback: true }), syntaxHighlighting(defaultHighlightStyle, { fallback: true }),

View file

@ -18,7 +18,7 @@ declare function ctx:map($fn as element(fos:function))
{ {
$fn!map{ $fn!map{
"label":string(@name), "label":string(@name),
"kind": 3, "kind": $lspt:CompletionItemKindMap("Function"),
"detail":string($fn/fos:summary/*), "detail":string($fn/fos:summary/*),
"documentation":`{ ctx:summary(.) } <a href="{ $ctx:doclink }{ string(@name) }" target="_blank">Spec</a>` "documentation":`{ ctx:summary(.) } <a href="{ $ctx:doclink }{ string(@name) }" target="_blank">Spec</a>`
!lspt:MarkupContent("markdown",.) !lspt:MarkupContent("markdown",.)

View file

@ -138,7 +138,7 @@
<summary>Messages <summary>Messages
<i id="msgIcon" class='codicon codicon-kebab-vertical' style="float:right"></i> <i id="msgIcon" class='codicon codicon-kebab-vertical' style="float:right"></i>
</summary> </summary>
<div id="msg">(msgs)<i class='codicon codicon-symbol-method'></i></div> <qd-list id="msgList" style="flex-grow:1;"></qd-list>
</details> </details>
</aside> </aside>

View file

@ -13958,6 +13958,12 @@ var lsp = (function (exports) {
return true; return true;
} }
} }
/**
Creates an extension that configures tooltip behavior.
*/
function tooltips(config = {}) {
return tooltipConfig.of(config);
}
function windowSpace(view) { function windowSpace(view) {
let docElt = view.dom.ownerDocument.documentElement; let docElt = view.dom.ownerDocument.documentElement;
return { top: 0, left: 0, bottom: docElt.clientHeight, right: docElt.clientWidth }; return { top: 0, left: 0, bottom: docElt.clientHeight, right: docElt.clientWidth };
@ -31359,7 +31365,7 @@ ${text}</tr>
drawSelection(), drawSelection(),
dropCursor(), dropCursor(),
EditorState.allowMultipleSelections.of(true), EditorState.allowMultipleSelections.of(true),
tooltips({ }), // clipped
keymap.of([indentWithTab]), keymap.of([indentWithTab]),
indentOnInput(), indentOnInput(),
syntaxHighlighting(defaultHighlightStyle, { fallback: true }), syntaxHighlighting(defaultHighlightStyle, { fallback: true }),

File diff suppressed because one or more lines are too long

View file

@ -177,12 +177,10 @@ function incoming(msg) {
function log(rpc) { function log(rpc) {
console.log("<-", rpc) console.log("<-", rpc)
if (rpc.id) return if (rpc.id) return;
const text = rpc.method; const msg = {name:rpc.method, detail:JSON.stringify (rpc).slice(0,5), kind:23 /* event */ };
const li = document.createElement("li"); //name,details,kind
const n = $("traffic").childElementCount + " "; $("msgList").setData([msg],true)
li.appendChild(document.createTextNode(n + text));
$("traffic").insertBefore(li, $("traffic").firstChild)
}; };
function formFromStore(name) { function formFromStore(name) {

View file

@ -1,6 +1,6 @@
/* Define a web component providing a settable and selectable list /* Define a web component providing a settable and selectable list
$("symList").setData(r, append = false); $("symList").setData(r, append = false);
where r is array of objects with properties name,details,kind where r is array of objects with properties name,detail,kind
https://stackoverflow.com/questions/50404970/web-components-pass-data-to-and-from https://stackoverflow.com/questions/50404970/web-components-pass-data-to-and-from
https://www.w3schools.com/howto/howto_js_treeview.asp https://www.w3schools.com/howto/howto_js_treeview.asp
@ -64,9 +64,7 @@ class ListComponent extends HTMLElement {
/* Render the list items #data */ /* Render the list items #data */
render() { render() {
const list = document.createElement('ul'); // eventhandler for click and keyboard, updates usage of selected class and raises event
list.style = "overflow: auto;";
const select = e => { const select = e => {
if(e.type ==="keyup" && !(e.key==="Enter" )) return; if(e.type ==="keyup" && !(e.key==="Enter" )) return;
this.#shadow.querySelectorAll('li.selected').forEach(item => { item.className = ''; }); this.#shadow.querySelectorAll('li.selected').forEach(item => { item.className = ''; });
@ -80,6 +78,9 @@ class ListComponent extends HTMLElement {
composed: true composed: true
})); }));
}; };
// create list and items
const list = document.createElement('ul');
list.style = "overflow: auto;";
this.#data.forEach((item, index) => { this.#data.forEach((item, index) => {
const listItem = document.createElement('li'); const listItem = document.createElement('li');
const icon=this.#iconKinds[item.kind]; const icon=this.#iconKinds[item.kind];