-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add webview with ability to change settings in runtime
- Loading branch information
Showing
33 changed files
with
15,234 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ vscode.d.ts | |
samples/**/.* | ||
.wdio* | ||
.tmp | ||
tests/e2e/screens-on-fail | ||
tests/e2e/**/screens-on-fail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.section__header { | ||
font-size: 11px; | ||
margin: 10px 0 3px 8px; | ||
font-weight: 700; | ||
color: var(--vscode-editor-inlineValuesForeground); | ||
text-transform: uppercase; | ||
} | ||
|
||
.section__list { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.section__list-item { | ||
height: 22px; | ||
line-height: 22px; | ||
padding-right: 2px; | ||
padding-left: 8px; | ||
display: flex; | ||
align-items: center; | ||
box-sizing: border-box; | ||
width: 100%; | ||
white-space: nowrap; | ||
flex: 0; | ||
cursor: pointer; | ||
} | ||
|
||
.section__list-item:hover { | ||
background-color: #e8e8e8; | ||
} | ||
|
||
body[data-vscode-theme-kind="vscode-dark"] .section__list-item:hover { | ||
background-color: #2a2d2e; | ||
} | ||
|
||
label { | ||
display: flex; | ||
align-items: center; | ||
cursor: inherit; | ||
flex: auto; | ||
} | ||
|
||
input[type="checkbox"] { | ||
margin-right: 4px; | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This script will be run within the webview itself | ||
// It cannot access the main VS Code APIs directly. | ||
(function () { | ||
// eslint-disable-next-line no-undef | ||
const vscode = acquireVsCodeApi(); | ||
listenSettingsCheckbox(); | ||
|
||
// eslint-disable-next-line no-undef | ||
window.addEventListener("message", event => { | ||
const { method, params } = event.data; | ||
|
||
if (method === "updateSettings") { | ||
for (const [key, value] of Object.entries(params.settings)) { | ||
// eslint-disable-next-line no-undef | ||
const input = document.querySelector(".section_type_settings input[settingName=" + key + "]"); | ||
|
||
if (!input) { | ||
continue; | ||
} | ||
|
||
if (typeof value === "boolean") { | ||
input.checked = value; | ||
} else { | ||
input.value = value; | ||
} | ||
} | ||
} | ||
}); | ||
|
||
function listenSettingsCheckbox() { | ||
// eslint-disable-next-line no-undef | ||
for (const checkbox of document.querySelectorAll(".section_type_settings input[type=checkbox]")) { | ||
checkbox.addEventListener("change", function (event) { | ||
vscode.postMessage({ | ||
method: "toggleSettingsCheckbox", | ||
params: { | ||
settingName: event.target.getAttribute("settingName"), | ||
value: this.checked, | ||
}, | ||
}); | ||
}); | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.