Skip to content

Commit

Permalink
Rust highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
focus-editor committed May 3, 2024
1 parent 12920c3 commit 1ed1430
Show file tree
Hide file tree
Showing 8 changed files with 752 additions and 2 deletions.
1 change: 1 addition & 0 deletions FOCUS-CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
+ New command: `copy_current_line_info`. Copies a string `<current-file-path>:<line>` to clipboard. Useful for setting breakpoints.
+ Basic HLSL highlighting (thanks @Roman-Skabin for many improvements)
+ Basic JSON highlighting (thanks @simonvallz)
+ Rust highlighting
+ Bug fixes:
+ Fixed the Jai code samples highlighting in build output in some cases
+ Fixed build output highlighting glitch when using the clear build output option
Expand Down
2 changes: 1 addition & 1 deletion config/default.focus-config
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ save_current_buffer_on_build: false


# Example error regexes:
# For jai: ^(?P<file>.*):(?P<line>\d+),(?P<col>\d+): (?P<type>Error|Warning|Info): (?P<msg>.*)|^(?P<msg>.*error LNK.*)
# For jai: ^(?P<file>.*):(?P<line>\d+),(?P<col>\d+): (?P<type>Error|Warning|Info|...):* (?P<msg>.*)|^(?P<msg1>.*error LNK.*)
# For msvc: ^(?P<file>.*)\((?P<line>\d+),(?P<col>\d+)\): (?P<type>error|warning) (?P<msg>.*)$
# ... let us know what regex works for you and we'll add it here

Expand Down
2 changes: 1 addition & 1 deletion config/default_macos.focus-config
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ build_panel_height_percent: 50


# Example error regexes:
# For jai: ^(?P<file>.*):(?P<line>\d+),(?P<col>\d+): (?P<type>Error|Warning|Info): (?P<msg>.*)|^(?P<msg>.*error LNK.*)
# For jai: ^(?P<file>.*):(?P<line>\d+),(?P<col>\d+): (?P<type>Error|Warning|Info|...):* (?P<msg>.*)|^(?P<msg1>.*error LNK.*)
# ... let us know what regex works for you and we'll add it here

# NOTE:
Expand Down
3 changes: 3 additions & 0 deletions src/buffer.jai
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ tokenize_for_indentation :: (buffer: *Buffer) -> [] Indentation_Token /* temp */
case .Xml; return tokenize_xml_for_indentation(buffer);
case .Lua; return tokenize_lua_for_indentation(buffer);
case .Odin; return tokenize_odin_for_indentation(buffer);
case .Rust; return tokenize_rust_for_indentation(buffer);
}

return .[];
Expand Down Expand Up @@ -1190,6 +1191,7 @@ get_tokenize_function :: (lang: Buffer.Lang) -> Tokenize_Function {
case .Odin; return highlight_odin_syntax;
case .Python; return highlight_python_syntax;
case .RenPy; return highlight_renpy_syntax;
case .Rust; return highlight_rust_syntax;
case .Html; return highlight_xml_syntax;
case .Xml; return highlight_xml_syntax;
case .Worklog; return highlight_worklog;
Expand Down Expand Up @@ -1378,6 +1380,7 @@ Buffer :: struct {
Odin;
Python;
RenPy;
Rust;
Xml;
Html;
Worklog;
Expand Down
1 change: 1 addition & 0 deletions src/editors.jai
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,7 @@ get_lang_from_path :: (path: string) -> Buffer.Lang {
case "odin"; lang = .Odin;
case "py"; lang = .Python;
case "rpy"; lang = .RenPy;
case "rs"; lang = .Rust;

case "vert"; #through;
case "frag"; #through;
Expand Down
1 change: 1 addition & 0 deletions src/langs/common.jai
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ get_lang_from_name :: (lang_name: string) -> Buffer.Lang {
if ends_with_nocase(lang_name, "odin") return .Odin;
if ends_with_nocase(lang_name, "python") return .Python;
if ends_with_nocase(lang_name, "renpy") return .RenPy;
if ends_with_nocase(lang_name, "rust") return .Rust;
if ends_with_nocase(lang_name, "html") return .Html;
if ends_with_nocase(lang_name, "xml") return .Xml;
if ends_with_nocase(lang_name, "worklog") return .Worklog;
Expand Down
Loading

0 comments on commit 1ed1430

Please sign in to comment.