Skip to content

Commit

Permalink
WiP
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Lewis committed Sep 28, 2023
1 parent 2ea8aea commit f2e0a92
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 109 deletions.
7 changes: 4 additions & 3 deletions src/dataEditor/dataEditorClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ import XDGAppPaths from 'xdg-app-paths'
import assert from 'assert'
import { SvelteWebviewInitializer } from './svelteWebviewInitializer'
import {
EditorMessage,
IMessage,
MessageCommand,
MessageInfo,

Check failure on line 66 in src/dataEditor/dataEditorClient.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: macos-11, Node: 16)

'MessageInfo' is declared but its value is never read.

Check failure on line 66 in src/dataEditor/dataEditorClient.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: macos-11, Node: 18)

'MessageInfo' is declared but its value is never read.

Check failure on line 66 in src/dataEditor/dataEditorClient.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: ubuntu-20.04, Node: 16)

'MessageInfo' is declared but its value is never read.

Check failure on line 66 in src/dataEditor/dataEditorClient.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: ubuntu-20.04, Node: 18)

'MessageInfo' is declared but its value is never read.

Check failure on line 66 in src/dataEditor/dataEditorClient.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: windows-2019, Node: 16)

'MessageInfo' is declared but its value is never read.

Check failure on line 66 in src/dataEditor/dataEditorClient.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: windows-2019, Node: 18)

'MessageInfo' is declared but its value is never read.
MessageLevel,
} from '../svelte/src/utilities/message'
import {
Expand Down Expand Up @@ -366,7 +367,7 @@ export class DataEditorClient implements vscode.Disposable {
}

// handle messages from the webview
private async messageReceiver(message: EditorMessage) {
private async messageReceiver(message: IMessage) {
switch (message.command) {
case MessageCommand.showMessage:
switch (message.data.messageLevel as MessageLevel) {
Expand Down Expand Up @@ -893,7 +894,7 @@ class DisplayState {
}
}

function fillRequestData(message: EditorMessage): [Buffer, string] {
function fillRequestData(message: IMessage): [Buffer, string] {
let selectionByteData: Buffer
let selectionByteDisplay: string
if (message.data.editMode === EditByteModes.Multiple) {
Expand Down
1 change: 1 addition & 0 deletions src/svelte/src/components/dataEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ limitations under the License.
window.addEventListener('message', (msg) => {
switch (msg.data.command) {
case MessageCommand.editorOnChange:
const data = msg.data.data
if ($editMode === EditByteModes.Multiple)
$editorSelection = msg.data.display
break
Expand Down
43 changes: 32 additions & 11 deletions src/svelte/src/utilities/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,38 @@
* limitations under the License.
*/

export enum MessageCommand {
export interface IMessage{
command: MessageCommand
data: Record<string, any>
}
export interface MessageInfo extends IMessage{
messageLevel: MessageLevel;
}

export abstract class Messenger{
public abstract makeMessage(message: MessageCommand, ...args: any[]): IMessage;
}

class MessageInfoSender extends Messenger{

Check failure on line 30 in src/svelte/src/utilities/message.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: macos-11, Node: 16)

'MessageInfoSender' is declared but never used.

Check failure on line 30 in src/svelte/src/utilities/message.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: macos-11, Node: 18)

'MessageInfoSender' is declared but never used.

Check failure on line 30 in src/svelte/src/utilities/message.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: ubuntu-20.04, Node: 16)

'MessageInfoSender' is declared but never used.

Check failure on line 30 in src/svelte/src/utilities/message.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: ubuntu-20.04, Node: 18)

'MessageInfoSender' is declared but never used.

Check failure on line 30 in src/svelte/src/utilities/message.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: windows-2019, Node: 16)

'MessageInfoSender' is declared but never used.

Check failure on line 30 in src/svelte/src/utilities/message.ts

View workflow job for this annotation

GitHub Actions / Build, Test, and Package (OS: windows-2019, Node: 18)

'MessageInfoSender' is declared but never used.
public makeMessage(
command: MessageCommand,
data: Record<string, any>,
messageLevel: MessageLevel
): MessageInfo{
return{
command,
data,
messageLevel,
};
}
}

export type MessageLevel =
| "Error"
| "Info"
| "Warn"

export enum MessageCommand {
clearChanges,
applyChanges,
editorOnChange,
Expand All @@ -38,13 +69,3 @@ export enum MessageCommand {
viewportRefresh,
}

export enum MessageLevel {
Error,
Info,
Warn,
}

export type EditorMessage = {
command: MessageCommand
data: Record<string, any>
}
103 changes: 8 additions & 95 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
# yarn lockfile v1


"@ampproject/remapping@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630"
integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==
dependencies:
"@jridgewell/gen-mapping" "^0.3.0"
"@jridgewell/trace-mapping" "^0.3.9"

"@babel/runtime@^7.21.0":
version "7.22.10"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.10.tgz#ae3e9631fd947cb7e3610d3e9d8fef5f76696682"
Expand Down Expand Up @@ -93,7 +85,7 @@
"@jridgewell/gen-mapping" "^0.3.0"
"@jridgewell/trace-mapping" "^0.3.9"

"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15":
"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.14":
version "1.4.15"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
Expand Down Expand Up @@ -273,7 +265,7 @@
"@types/estree" "*"
"@types/json-schema" "*"

"@types/estree@*", "@types/estree@^1.0.0", "@types/estree@^1.0.1":
"@types/estree@*", "@types/estree@^1.0.0":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.1.tgz#aa22750962f3bf0e79d753d3cc067f010c95f194"
integrity sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==
Expand Down Expand Up @@ -614,7 +606,7 @@ acorn-walk@^8.1.1:
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==

acorn@^8.10.0, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.2, acorn@^8.9.0:
acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.2:
version "8.10.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5"
integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==
Expand Down Expand Up @@ -712,13 +704,6 @@ argparse@^2.0.1:
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==

aria-query@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e"
integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==
dependencies:
dequal "^2.0.3"

assertion-error@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
Expand All @@ -739,13 +724,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/await-notify/-/await-notify-1.0.1.tgz#0b48133b22e524181e11557665185f2a2f3ce47c"
integrity sha512-eT6XN2ycPKvuiffzUNmU0dnGmmLw+TexMW7UKOyf5utdVrWx14PR2acRIfy6ZfFWRAv8twt1X74VUgd9RnDmfQ==

axobject-query@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-3.2.1.tgz#39c378a6e3b06ca679f29138151e45b2b32da62a"
integrity sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==
dependencies:
dequal "^2.0.3"

azure-devops-node-api@^11.0.1:
version "11.2.0"
resolved "https://registry.yarnpkg.com/azure-devops-node-api/-/azure-devops-node-api-11.2.0.tgz#bf04edbef60313117a0507415eed4790a420ad6b"
Expand Down Expand Up @@ -1089,17 +1067,6 @@ clone-deep@^4.0.1:
kind-of "^6.0.2"
shallow-clone "^3.0.0"

code-red@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/code-red/-/code-red-1.0.4.tgz#59ba5c9d1d320a4ef795bc10a28bd42bfebe3e35"
integrity sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.15"
"@types/estree" "^1.0.1"
acorn "^8.10.0"
estree-walker "^3.0.3"
periscopic "^3.1.0"

color-convert@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
Expand Down Expand Up @@ -1262,7 +1229,7 @@ css-select@^5.1.0:
domutils "^3.0.1"
nth-check "^2.0.1"

css-tree@^2.2.1, css-tree@^2.3.1:
css-tree@^2.2.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-2.3.1.tgz#10264ce1e5442e8572fc82fbe490644ff54b5c20"
integrity sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==
Expand Down Expand Up @@ -1393,11 +1360,6 @@ defer-to-connect@^2.0.1:
resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587"
integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==

dequal@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be"
integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==

detect-indent@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6"
Expand Down Expand Up @@ -1557,13 +1519,6 @@ estraverse@^5.2.0:
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123"
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==

estree-walker@^3.0.0, estree-walker@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-3.0.3.tgz#67c3e549ec402a487b4fc193d1953a524752340d"
integrity sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==
dependencies:
"@types/estree" "^1.0.0"

event-target-shim@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
Expand Down Expand Up @@ -2049,13 +2004,6 @@ is-plain-object@^2.0.4:
dependencies:
isobject "^3.0.1"

is-reference@^3.0.0, is-reference@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-3.0.2.tgz#154747a01f45cd962404ee89d43837af2cba247c"
integrity sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==
dependencies:
"@types/estree" "*"

is-stream@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077"
Expand Down Expand Up @@ -2238,11 +2186,6 @@ loader-utils@^2.0.4:
emojis-list "^3.0.0"
json5 "^2.1.2"

locate-character@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/locate-character/-/locate-character-3.0.0.tgz#0305c5b8744f61028ef5d01f444009e00779f974"
integrity sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==

locate-path@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
Expand Down Expand Up @@ -2316,13 +2259,6 @@ magic-string@^0.27.0:
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.13"

magic-string@^0.30.0:
version "0.30.3"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.3.tgz#403755dfd9d6b398dfa40635d52e96c5ac095b85"
integrity sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.15"

make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
Expand Down Expand Up @@ -2734,15 +2670,6 @@ pend@~1.2.0:
resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50"
integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==

periscopic@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/periscopic/-/periscopic-3.1.0.tgz#7e9037bf51c5855bd33b48928828db4afa79d97a"
integrity sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==
dependencies:
"@types/estree" "^1.0.0"
estree-walker "^3.0.0"
is-reference "^3.0.0"

picocolors@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
Expand Down Expand Up @@ -3663,24 +3590,10 @@ svelte-preprocess@^5.0.4:
sorcery "^0.11.0"
strip-indent "^3.0.0"

svelte@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-4.2.0.tgz#0e4304c15524450b22fba02516eb72efbd8847b6"
integrity sha512-kVsdPjDbLrv74SmLSUzAsBGquMs4MPgWGkGLpH+PjOYnFOziAvENVzgJmyOCV2gntxE32aNm8/sqNKD6LbIpeQ==
dependencies:
"@ampproject/remapping" "^2.2.1"
"@jridgewell/sourcemap-codec" "^1.4.15"
"@jridgewell/trace-mapping" "^0.3.18"
acorn "^8.9.0"
aria-query "^5.3.0"
axobject-query "^3.2.1"
code-red "^1.0.3"
css-tree "^2.3.1"
estree-walker "^3.0.3"
is-reference "^3.0.1"
locate-character "^3.0.0"
magic-string "^0.30.0"
periscopic "^3.1.0"
svelte@^3.55.0:
version "3.59.2"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.59.2.tgz#a137b28e025a181292b2ae2e3dca90bf8ec73aec"
integrity sha512-vzSyuGr3eEoAtT/A6bmajosJZIUWySzY2CzB3w2pgPvnkUjGqlDnsNnA0PMO+mMAhuyMul6C2uuZzY6ELSkzyA==

svgo@^3.0.2:
version "3.0.2"
Expand Down

0 comments on commit f2e0a92

Please sign in to comment.