mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-07 10:16:03 -10:00
feat(editor): highlight Arduino sketches as C++ (#1874)
Open .ino sketches with C++ highlighting and the C++ file icon. Sketches get their own Arduino language with no language server: clangd can't compile a sketch on its own (implicit Arduino.h, generated prototypes) and reported "Unable to handle compilation" on line 1 of every sketch. Co-authored-by: mushketer888 <[email protected]>
This commit is contained in:
1 parent
ee6786d573
commit
1af1744290
3 files changed
+13
-1
No files matched your search
@@ -9,6 +9,7 @@ use std::sync::{Arc, OnceLock};
|
||||
|
||||
/// Built-in definitions, embedded at compile time. Add new languages here.
|
||||
const BUILTIN: &[(&str, &str)] = &[
|
||||
("arduino", include_str!("../../../languages/arduino.toml")),
|
||||
("asciidoc", include_str!("../../../languages/asciidoc.toml")),
|
||||
("astro", include_str!("../../../languages/astro.toml")),
|
||||
("bat", include_str!("../../../languages/bat.toml")),
|
||||
@@ -860,6 +861,7 @@ mod tests {
|
||||
("x.h", "c"),
|
||||
("x.hpp", "cpp"),
|
||||
("x.cc", "cpp"),
|
||||
("blink.ino", "arduino"),
|
||||
("P.cs", "csharp"),
|
||||
("V.swift", "swift"),
|
||||
("AppDelegate.m", "objective-c"),
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
id = "arduino"
|
||||
name = "Arduino"
|
||||
# Sketches are C++ with an implicit `Arduino.h` and generated prototypes; clangd can't compile
|
||||
# them on its own, so they get C++ highlighting without a language server.
|
||||
extensions = ["ino"]
|
||||
line-comment = "//"
|
||||
block-comment = ["/*", "*/"]
|
||||
indent = { tab-size = 2, insert-spaces = true }
|
||||
ui-mode = "C++"
|
||||
tree-sitter = "cpp"
|
||||
+1
-1
@@ -991,7 +991,7 @@ const EXT_ICONS = table({
|
||||
"file-perl": "pl pm pod psgi cgi",
|
||||
"file-c": "c",
|
||||
"file-h": "h hpp hh hxx h++",
|
||||
"file-cpp": "cpp cc cxx c++ ipp tpp inl ixx cppm",
|
||||
"file-cpp": "cpp cc cxx c++ ipp tpp inl ixx cppm ino",
|
||||
"file-objc": "m",
|
||||
"file-objcpp": "mm",
|
||||
"file-csharp": "cs csx",
|
||||
|
||||
Reference in new issue
Block a user