Skip to content

Commit

Permalink
does this still compile?
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimaoth committed Jan 4, 2024
1 parent 13fbece commit 003e5a5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
9 changes: 9 additions & 0 deletions src/absytree.nim
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ when enableGui:
log lvlInfo, fmt"True colors: {trueColorSupport}"

# Do this after every import
# Don't remove those imports, they are needed by createNimScriptContextConstructorAndGenerateBindings
import std/[macrocache]
import ast/model_document
import text/text_editor
import text/language/lsp_client
import selector_popup
when not defined(js):
import wasm3, wasm3/[wasm3c, wasmconversions]

createNimScriptContextConstructorAndGenerateBindings()

# Initialize renderer
Expand Down
6 changes: 6 additions & 0 deletions src/absytree_js.nim
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import app

import ui/node

# Don't remove those imports, they are needed by createNimScriptContextConstructorAndGenerateBindings
import std/[macrocache]
import ast/model_document
import text/text_editor
import text/language/lsp_client
import selector_popup
createNimScriptContextConstructorAndGenerateBindings()

# Initialize renderer
Expand Down
7 changes: 0 additions & 7 deletions src/app.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1963,10 +1963,6 @@ proc handleAction(self: App, action: string, arg: string): bool =
return true

template createNimScriptContextConstructorAndGenerateBindings*(): untyped =
import ast/model_document
import text/text_editor
import text/language/lsp_client
import selector_popup
when not defined(js):
proc createAddins(): VmAddins =
addCallable(myImpl):
Expand Down Expand Up @@ -1996,7 +1992,4 @@ template createNimScriptContextConstructorAndGenerateBindings*(): untyped =
proc createScriptContextImpl(filepath: string, searchPaths: seq[string]): Future[ScriptContext] = createScriptContextNim(filepath, searchPaths)
createScriptContext = createScriptContextImpl

when not defined(js):
import wasm3, wasm3/[wasm3c, wasmconversions]

createEditorWasmImportConstructor()
2 changes: 1 addition & 1 deletion src/input.nim
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ proc createOrUpdateState(dfa: var CommandDFA, currentState: int, inputCode: int6
linkState(dfa, currentState, nextState, inputCode, mods)
return nextState

proc parseNextInput(input: openArray[Rune], index: int, leader: (int64, Modifiers) = (0, {})): tuple[inputCode: int64, mods: Modifiers, nextIndex: int, persistent: bool] =
proc parseNextInput(input: openArray[Rune], index: int, leader: (int64, Modifiers) = (0.int64, {})): tuple[inputCode: int64, mods: Modifiers, nextIndex: int, persistent: bool] =
result.inputCode = 0
result.mods = {}
result.nextIndex = index
Expand Down
4 changes: 2 additions & 2 deletions src/platform/terminal_platform.nim
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ proc setForegroundColor(self: TerminalPlatform, color: chroma.Color) =
self.buffer.setForegroundColor(color.toStdColor)
else:
let stdColor = color.toStdColor.extractRGB
let fgColor = getClosestColor[tui.ForegroundColor](stdColor.r, stdColor.g, stdColor.b, fgWhite)
let fgColor = getClosestColor[tui.ForegroundColor](stdColor.r, stdColor.g, stdColor.b, tui.fgWhite)
self.buffer.setForegroundColor(fgColor)

proc setBackgroundColor(self: TerminalPlatform, color: chroma.Color) =
if self.trueColorSupport:
self.buffer.setBackgroundColor(color.toStdColor, color.a)
else:
let stdColor = color.toStdColor.extractRGB
let bgColor = getClosestColor[tui.BackgroundColor](stdColor.r, stdColor.g, stdColor.b, bgBlack)
let bgColor = getClosestColor[tui.BackgroundColor](stdColor.r, stdColor.g, stdColor.b, tui.bgBlack)
self.buffer.setBackgroundColor(bgColor)

proc fillRect(self: TerminalPlatform, bounds: Rect, color: chroma.Color) =
Expand Down
1 change: 0 additions & 1 deletion src/scripting/scripting_wasm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ method handleScriptAction*(self: ScriptContextWasm, name: string, args: JsonNode
# because this goes through all exposed functions at compile time to create the wasm import data.
# That's why it's in a template
template createEditorWasmImportConstructor*() =
import std/[macrocache]
proc createEditorWasmImportsImpl(): WasmImports =
macro addEditorFunctions(imports: WasmImports): untyped =
var list = nnkStmtList.newTree()
Expand Down

0 comments on commit 003e5a5

Please sign in to comment.