General purpose web IDE for MLscript#367
Conversation
|
FYI: pressing tab does not insert whitespace, but instead navigates to the next element |
| val pwd = os.pwd | ||
| val workingDir = pwd | ||
|
|
||
| val mainTestDir = workingDir/"hkmc2"/"shared"/"src"/"test" | ||
| val stdPath = mainTestDir / "mlscript-compile" | ||
|
|
||
| val compilerPaths = new MLsCompiler.Paths: | ||
| val preludeFile = mainTestDir / "mlscript" / "decls" / "Prelude.mls" | ||
| val runtimeFile = mainTestDir / "mlscript-compile" / "Runtime.mjs" | ||
| val termFile = mainTestDir / "mlscript-compile" / "Term.mjs" | ||
|
|
||
| val nodeModulesPath = workingDir / "node_modules" |
There was a problem hiding this comment.
Any reason to move all of these in the companion? Doing so means they can no longer be overridden by other users of the test suite. (There is just one example with BenchTestState for now.)
| import hkmc2.semantics.* | ||
| import hkmc2.syntax.Keyword.`override` | ||
| import semantics.Elaborator.{Ctx, State} | ||
| import hkmc2.io.Path |
|
|
||
| raise: | ||
| ErrorReport(msg"Cannot resolve the import path ${actualFile.toString}" -> rawPath.toLoc :: Nil) | ||
| Import(sym, rawPath.value, actualFile) No newline at end of file |
There was a problem hiding this comment.
| Import(sym, rawPath.value, actualFile) | |
| Import(sym, rawPath.value, actualFile) | |
| catch ex => | ||
| // System.err.println("Unexpected error in watcher: " + ex) | ||
| // ex.printStackTrace() | ||
| ex.printStackTrace() |
There was a problem hiding this comment.
Isn't the stack trace already shown when throw ex propagates to the top-level?
|
How about having a special syntax to denote that |
|
I didn't know TypeScript did that. It's not strictly necessary (since paths not starting with |
The practice you mentioned should be more or less like, in TypeScript projects, some people use I plan to implement path remapping options like this. So that projects in
As to whether we should use |
46c5ce1 to
414cf0c
Compare
f5b9c17 to
323afbd
Compare
Resolve merge fallout around module import aliases, split test runners, and test-folder ownership.
| ```mlscript | ||
| fun fromMaybe(x) = if x is | ||
| Some(value) then value | ||
| ~Some(_) then default |
There was a problem hiding this comment.
This can be just ~Some then ...
| } | ||
| mut | ||
| 'type: "compile-success" | ||
| // BUG: `:field` puns currently miscompile in multiline `mut` records here. |
| if this.unsubscribe is | ||
| Absent then () | ||
| unsubscribe then unsubscribe() |
There was a problem hiding this comment.
Should use ~Absent and do instead. I was better before!
| else this.openTabs.get(this.activeTabId) | ||
| fun handleFsEventForTab(tabId, tab, event) = if | ||
| tab.path !== event.path then () | ||
| event.("type") is |
| fun handleFsEventForTab(tabId, tab, event) = if | ||
| tab.path !== event.path then () | ||
| event.("type") is | ||
| "delete" then this.closeTab(tabId) |
| not Number.isFinite(timestamp) then "" | ||
| else | ||
| let divisions = [ | ||
| (amount: 60, unit: "seconds"), |
There was a problem hiding this comment.
All end-of-line commas that do not introduce a nested block are unnecessary.
| endLine: endPos.line, | ||
| endColumn: endPos.column, | ||
| mut | ||
| startLine: (startPos.line) |
There was a problem hiding this comment.
Are the parens really necessary?
| else node.children | ||
| fun childrenOf(node) = if node.children is | ||
| Absent then [] | ||
| ~Absent as children then children |
|
|
||
| #### Prefer quoted field selection for keyword-like fields | ||
|
|
||
| When selecting a field whose name is keyword-like, prefer quoted field selection |
There was a problem hiding this comment.
Lol it's not about being keyword-like, it's about being a single word/identifier.
| set this.activeTabId = tabId | ||
| tab.editorView.focus() | ||
| if selectedTab is ~Absent as tab do | ||
| tab.editorDiv.classList.add("active") |
| this.openTabs.delete(tabId) | ||
| if this.activeTabId === tabId do | ||
| let remainingTabs = Array.from(this.openTabs.keys()) | ||
| if |
Note
The web IDE is (manually) deployed and accessible at https://mlscript.fun.
Planned Tasks
import "std/Stack.mls"instead of using relative paths.Bugs to be fixed