Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,12 @@ All notable changes to the "vscode-nushell-lang" extension will be documented in
- Snippets (support regex groups) [#130](https://github.com/nushell/vscode-nushell-lang/pull/130)
- Use unique labels for durationWrapper [#133](https://github.com/nushell/vscode-nushell-lang/pull/133)
- Fix TextMate regex that linguist discovered [#137](https://github.com/nushell/vscode-nushell-lang/pull/137)
- 1.7.0
- Fix datetime parsing (@glcraft) [#140](https://github.com/nushell/vscode-nushell-lang/pull/140)
- Fix go-to definition on Windows (@gaetschwartz) [#141](https://github.com/nushell/vscode-nushell-lang/pull/141)
- Don't try to read if file doesn't exist (@gaetschwartz) [#143](https://github.com/nushell/vscode-nushell-lang/pull/143)
- Me forgetting to merge changes (@fdncred) [#145](https://github.com/nushell/vscode-nushell-lang/pull/145)
- npm audit fix (@fdncred) [#147](https://github.com/nushell/vscode-nushell-lang/pull/147)
- Update link (@balupton) [#149](https://github.com/nushell/vscode-nushell-lang/pull/149)
- Fix shebang detection (@adamcstephens) [#151](https://github.com/nushell/vscode-nushell-lang/pull/151)
- use `which` to find `nu` + add icon (@nerditation) [#153](https://github.com/nushell/vscode-nushell-lang/pull/153)
12 changes: 12 additions & 0 deletions building.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,15 @@ If you have all these tools already installed, you should be able to clone this
## Regex Engine

TIL - VSCode uses regexes for language syntax highlighting in \*.tmLanguage.json files. Those regexes and json are based on Textmate, which uses (and here is the secret-sauce) `oniguruma` flavor of syntax. See the cheat-sheet for the [syntax here](https://github.com/kkos/oniguruma/blob/master/doc/RE). Also there's a rust-crate called `onig` or `rust-onig` if we wanted to write something to help create compatible regular expressions.

## list-to-tree

glcraft wrote a fancy program to create regexes for the extension. Here's the steps to use it.

1. clone and cargo install the tool. https://github.com/glcraft/list-to-tree
2. on windows create a set of commands. `scope commands | where is_builtin == true and is_custom == false | get name | to text | save win-cmds_20230919.txt`
3. on linux create a set of commands. `scope commands | where is_builtin == true and is_custom == false | get name | to text | save lin-cmds_20230919.txt`
4. combine these two files, sort, and uniq them. `open win-cmds_20230919.txt | lines | append (open lin-cmds_20230919.txt | lines) | sort | uniq | save cmds_20230919.txt`
5. run list-to-tree `list-to-tree --input cmds_20230919.txt --format regex`
6. copy-n-paste the results to the `nushell.tmLanguage.json` file in the appropriate place (search for "list-to-tree"). Be careful, this can be tricky.
7. test out the changes with F5 and viewing some scripts.
Loading