-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on a custom syntax file with a Swift shebang #3450
Comments
You should better start by copying something present to your local config folder (e.g. https://github.com/zyedidia/micro/blob/master/runtime/syntax/awk.yaml). The problem is that you define your syntax file without top level PS: |
Okay, I misunderstood the intention of syntax files, and they should be full-fledged highlighting rules. I'll remove my invalid syntax file, as I don't want to completely override the original rules. Could you kindly add a shebang to the swift.yaml then? I would do that, but I don't think this one-liner deserves a PR. |
Oh, most probably misunderstood you too. You can workaround the current situation by using the following custom filetype: swift
detect:
filename: "\\.swift$"
header: "^#!.*bin/(env +)?swift( |$)"
rules:
- include: "swift" It includes the rules of the builtin definition, but extends them with the own
Sure you can, you've the example present above. 😉 |
Opened a PR #3451 |
FWIW, the crash was fixed by #3213. The fix is present in 2.0.14. |
Ah, right. Already forgot this. 👍 |
Description of the problem or steps to reproduce
Preamble
The Micro has syntax support for Swift language, but only when filenames end with the
.swift
extension. Unfortunately, it doesn't recognize a shebang#!/usr/bin/swift
and no syntax highlighting as the result. The shebang is totally valid on macOS, as that's the official Swift interpreter.Problem
I decided to create a custom syntax file
~/.config/micro/syntax/swift.yaml
with the following content:Now, whenever I create a new file, add a shebang
#!/usr/bin/swift
, and then save it, the editor crashes every time with the following output:If I open an already existing file with the same shebang, I get a crash with the following output:
Both stacktraces are pointing at this line.
Specifications
The micro is installed using macports.
Version: 2.0.13
Commit hash: unknown
Compiled on January 12, 2024
The text was updated successfully, but these errors were encountered: