From 790313b63f5a603547da067da0272ff5a1b5fb34 Mon Sep 17 00:00:00 2001
From: itdominator <1itdominator@gmail.com>
Date: Wed, 17 Apr 2024 00:16:12 -0500
Subject: [PATCH] Attempted message.backend stubbing when not in webkit;
setting additions and changes, LSP efforts
---
.../usr/share/newton/context_path/index.html | 4 +-
.../resources/js/libs/eventemitter3.min.js | 1 +
.../resources/js/newton/components.js | 9 ++-
.../resources/js/newton/events.js | 4 +-
.../resources/js/newton/globals.js | 76 +++++++++++++++----
.../resources/js/newton/lsp-manager.js | 4 +
6 files changed, 76 insertions(+), 22 deletions(-)
create mode 100644 user_config/usr/share/newton/context_path/resources/js/libs/eventemitter3.min.js
diff --git a/user_config/usr/share/newton/context_path/index.html b/user_config/usr/share/newton/context_path/index.html
index 4c38a3d..5b8162e 100644
--- a/user_config/usr/share/newton/context_path/index.html
+++ b/user_config/usr/share/newton/context_path/index.html
@@ -266,8 +266,8 @@
-
-
+
+
diff --git a/user_config/usr/share/newton/context_path/resources/js/libs/eventemitter3.min.js b/user_config/usr/share/newton/context_path/resources/js/libs/eventemitter3.min.js
new file mode 100644
index 0000000..98a61fc
--- /dev/null
+++ b/user_config/usr/share/newton/context_path/resources/js/libs/eventemitter3.min.js
@@ -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 {
+ if (eve.key !== "Enter") {
+ let elm = this.shadowRoot.getElementById("find-all-btn");
+ elm.click();
+ }
+ });
elm = this.shadowRoot.getElementById("find-btn");
elm.addEventListener("click", (eve) => {
diff --git a/user_config/usr/share/newton/context_path/resources/js/newton/events.js b/user_config/usr/share/newton/context_path/resources/js/newton/events.js
index c13cbf3..da5cf01 100644
--- a/user_config/usr/share/newton/context_path/resources/js/newton/events.js
+++ b/user_config/usr/share/newton/context_path/resources/js/newton/events.js
@@ -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 = "");
}
diff --git a/user_config/usr/share/newton/context_path/resources/js/newton/globals.js b/user_config/usr/share/newton/context_path/resources/js/newton/globals.js
index 098e92b..b188f23 100644
--- a/user_config/usr/share/newton/context_path/resources/js/newton/globals.js
+++ b/user_config/usr/share/newton/context_path/resources/js/newton/globals.js
@@ -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
-};
\ No newline at end of file
+
+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);
+}
+}};
\ No newline at end of file
diff --git a/user_config/usr/share/newton/context_path/resources/js/newton/lsp-manager.js b/user_config/usr/share/newton/context_path/resources/js/newton/lsp-manager.js
index 9b8690c..a2babcc 100644
--- a/user_config/usr/share/newton/context_path/resources/js/newton/lsp-manager.js
+++ b/user_config/usr/share/newton/context_path/resources/js/newton/lsp-manager.js
@@ -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}`);
}
}