Skip to content

Commit

Permalink
Merge pull request #25 from shader-slang/lsp
Browse files Browse the repository at this point in the history
More UI fixes.
  • Loading branch information
csyonghe authored Oct 31, 2024
2 parents efbccca + 0fd4a25 commit 066f574
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
7 changes: 0 additions & 7 deletions language-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,6 @@ function initMonaco() {

monaco.languages.register({ id: "spirv" });
monaco.languages.setMonarchTokensProvider("spirv", {
brackets: [
{ open: '{', close: '}', token: 'delimiter.curly' },
{ open: '[', close: ']', token: 'delimiter.square' },
{ open: '(', close: ')', token: 'delimiter.parenthesis' },
],
operators: [
'=',
],
Expand Down Expand Up @@ -322,8 +317,6 @@ function initMonaco() {
[/;.*/, 'comment'],

// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, {
cases: {
'@operators': 'operator',
Expand Down
11 changes: 11 additions & 0 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ button:disabled:hover {
background-color: var(--panel-background);
padding: 10px;
flex-wrap: wrap;
overflow-x: hidden;
}

.logo-img {
Expand Down Expand Up @@ -448,4 +449,14 @@ label {
/* Visible tooltip styling */
.tooltip.show {
opacity: 1;
}

/* Narrow screen */
@media screen and (max-width: 450px) {
.dropdown-select{
min-width: 100px;
}
#demo-select{
width: 150px;
}
}
3 changes: 2 additions & 1 deletion try-slang.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ var Module = {
label.innerText = "Initializing Slang Compiler...";
compiler = new SlangCompiler(Module);
slangd = Module.createLanguageServer();
initLanguageServer();
var result = compiler.init();
if (result.ret) {
document.getElementById("compile-btn").disabled = false;
Expand Down Expand Up @@ -486,6 +485,8 @@ function runIfFullyInitialized()
{
if (compiler && slangd && pageLoaded)
{
initLanguageServer();

const loadingScreen = document.getElementById('loading-screen');
// Start fade-out by setting opacity to 0
loadingScreen.style.opacity = '0';
Expand Down
10 changes: 9 additions & 1 deletion ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ function prepareForResize() {
var codeEditors = document.getElementsByClassName("editorContainer");

for (var i = 0; i < codeEditors.length; i++) {
if (codeEditors[i].parentNode.clientWidth < 30)
codeEditors[i].style.display = "none";
else
codeEditors[i].style.display = "inherit";
codeEditors[i].style.overflow = "hidden";
}
document.getElementById("workSpaceDiv").style.overflow = "hidden";
Expand All @@ -95,6 +99,10 @@ function finishResizing() {
document.getElementById("leftContainerDiv").style.overflow = "visible";
for (var i = 0; i < codeEditors.length; i++) {
codeEditors[i].style.overflow = "visible";
if (codeEditors[i].parentNode.clientWidth < 30)
codeEditors[i].style.display = "none";
else
codeEditors[i].style.display = "inherit";
}
}

Expand All @@ -115,7 +123,7 @@ function initializeModal() {
const closeBtn = document.querySelector(".close");

btn.onclick = () => {
modal.style.display = "block";
modal.style.display = "flex";
};

closeBtn.onclick = () => {
Expand Down

0 comments on commit 066f574

Please sign in to comment.