Attempted message.backend stubbing when not in webkit; setting additions and changes, LSP efforts

This commit is contained in:
itdominator 2024-04-17 00:16:12 -05:00
parent 238a05591d
commit 790313b63f
6 changed files with 76 additions and 22 deletions

View File

@ -266,8 +266,8 @@
</script>
<!-- For internal scripts... -->
<script src="resources/js/libs/jquery-3.7.1.min.js"></script>
<!-- <script src="resources/js/libs/require.js"></script> -->
<script src="resources/js/libs/jquery-3.7.1.min.js"></script>
<!-- <script src="resources/js/libs/require.js"></script> -->
<!-- For Bootstrap... -->
<script src="resources/js/libs/bootstrap5/bootstrap.bundle.min.js"></script>

View File

@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).EventEmitter3=t()}(this,(function(){"use strict";var e={};return function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,i){if("function"!=typeof r)throw new TypeError("The listener must be a function");var c=new o(r,s||e,i),f=n?n+t:t;return e._events[f]?e._events[f].fn?e._events[f]=[e._events[f],c]:e._events[f].push(c):(e._events[f]=c,e._eventsCount++),e}function i(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function c(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),c.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},c.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,i=new Array(s);o<s;o++)i[o]=r[o].fn;return i},c.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},c.prototype.emit=function(e,t,r,o,s,i){var c=n?n+e:e;if(!this._events[c])return!1;var f,u,a=this._events[c],l=arguments.length;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),l){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,r),!0;case 4:return a.fn.call(a.context,t,r,o),!0;case 5:return a.fn.call(a.context,t,r,o,s),!0;case 6:return a.fn.call(a.context,t,r,o,s,i),!0}for(u=1,f=new Array(l-1);u<l;u++)f[u-1]=arguments[u];a.fn.apply(a.context,f)}else{var p,v=a.length;for(u=0;u<v;u++)switch(a[u].once&&this.removeListener(e,a[u].fn,void 0,!0),l){case 1:a[u].fn.call(a[u].context);break;case 2:a[u].fn.call(a[u].context,t);break;case 3:a[u].fn.call(a[u].context,t,r);break;case 4:a[u].fn.call(a[u].context,t,r,o);break;default:if(!f)for(p=1,f=new Array(l-1);p<l;p++)f[p-1]=arguments[p];a[u].fn.apply(a[u].context,f)}}return!0},c.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,r,o){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return i(this,s),this;var c=this._events[s];if(c.fn)c.fn!==t||o&&!c.once||r&&c.context!==r||i(this,s);else{for(var f=0,u=[],a=c.length;f<a;f++)(c[f].fn!==t||o&&!c[f].once||r&&c[f].context!==r)&&u.push(c[f]);u.length?this._events[s]=1===u.length?u[0]:u:i(this,s)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&i(this,t)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c}({get exports(){return e},set exports(t){e=t}}),e}));//# sourceMappingURL=eventemitter3.umd.min.js.map

View File

@ -204,11 +204,14 @@ class SearchReplaceContainer extends HTMLElement {
elm.click();
return;
}
let elm = this.shadowRoot.getElementById("find-all-btn");
elm.click();
});
elm.addEventListener("keyup", (eve) => {
if (eve.key !== "Enter") {
let elm = this.shadowRoot.getElementById("find-all-btn");
elm.click();
}
});
elm = this.shadowRoot.getElementById("find-btn");
elm.addEventListener("click", (eve) => {

View File

@ -26,13 +26,15 @@ const defineCustomElements = () => {
}
const loadLSPClientJSFiles = () => {
// sendMessage(topic = "load_json", ftype = "", fhash = "", fpath = LSP_SERVER_CONFG, content = "");
// TODO: convert to using similar call to above and remove if check in the ajax file
sendMessage(topic = "load_javascript", ftype = "", fhash = "", fpath = LSP_SERVER_CONFG, content = "");
sendMessage(topic = "load_javascript", ftype = "", fhash = "", fpath = `${BASE_LINK}/ace-linters.js`, content = "");
sendMessage(topic = "load_javascript", ftype = "", fhash = "", fpath = `${BASE_LINK}/base-service.js`, content = "");
sendMessage(topic = "load_javascript", ftype = "", fhash = "", fpath = `${BASE_LINK}/service-manager.js`, content = "");
sendMessage(topic = "load_javascript", ftype = "", fhash = "", fpath = `${BASE_LINK}/language-client.js`, content = "");
// Note: If using builtin services tghan connecting to a socket.
// Note: If using builtin services than connecting to a socket.
// sendMessage(topic = "load_javascript", ftype = "", fhash = "", fpath = `${BASE_LINK}/python-service.js`, content = "");
}

View File

@ -1,33 +1,37 @@
const messenger = (window.webkit) ? window.webkit.messageHandlers : (message) => {
console.log("Message: " + message);
};
const EDITOR_OPTS = {
behavioursEnabled: true,
printMarginColumn: 80,
enableBasicAutocompletion: true,
enableInlineAutocompletion: true,
// enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true,
liveAutocompletionDelay: 10,
liveAutocompletionThreshold: 2,
highlightActiveLine: true,
enableMultiselect: true,
tabSize: 4,
useSoftTabs: true,
useElasticTabstops: true,
// useElasticTabstops: true,
tooltipFollowsMouse: true,
useWrapMode: false,
wrapBehavioursEnabled: false,
scrollPastEnd: 0.5,
mergeUndoDeltas: false,
showGutter: true,
customScrollbar: true,
navigateWithinSoftTabs: true
navigateWithinSoftTabs: true,
scrollSpeed: 5
};
const QueryState = {
Searching: 0,
SearchSuccess: 1,
SearchFail: 2
};
const BASE_LINK = `${window.location.href}resources/js/libs/ace_editor/lsp`;
const LSP_SERVER_CONFG = `${window.location.href}../lsp-servers-config.json`;
const BASE_LSP_LINK = "http://0.0.0.0:4880";
const BASE_LSP_LINK = "http://0.0.0.0:3030";
const SCRIPT_BLOB_URLs = {};
let lspProvider = null;
@ -50,8 +54,48 @@ let queryMarkers = [];
let blockHigherNewtonEvePropigation = false;
const QueryState = {
Searching: 0,
SearchSuccess: 1,
SearchFail: 2
};
const messenger = (window.webkit) ? window.webkit.messageHandlers : {"backend": {"postMessage": (message) => {
let json = JSON.parse(message);
let topic = json["topic"];
if (topic === "load_javascript") {
let elm = document.createElement("SCRIPT");
elm.src = json["fpath"];
document.body.append(elm);
return;
}
if (topic === "load_json"
// &&
// json["fpath"].includes("lsp-servers-config.json")
) {
fetch( json["fpath"] )
.then((response) => response.json())
.then((response) => {
lspServersConfig = response;
loadSettingsFileToUI();
});
return;
}
if (topic === "load_starting_files") {
return;
}
if (topic === "set_info_labels") {
return;
}
if (topic === "load_buffer") {
return;
}
if (topic === "open_file") {
return;
}
console.log("Message Backend: " + message);
}
}};

View File

@ -126,6 +126,9 @@ const generateElement = (config = {}, parent = "", elm = null) => {
case Boolean.prototype:
handleBoolean(config, parent, elm);
break;
case Number.prototype:
console.log("Number generatable HTML type stub...");
break;
case Map.prototype:
console.log("Map generatable HTML type stub...");
@ -139,6 +142,7 @@ const generateElement = (config = {}, parent = "", elm = null) => {
}
console.log("No generatable HTML type...");
console.log(`config: ${config}\nparent: ${parent}\nelm: ${elm}`);
}
}