Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

feat(editor): highlight Arduino sketches as C++ (#1874)

Ilya L1af174429023
diff --git a/crates/ide-language/src/registry.rs b/crates/ide-language/src/registry.rs
index 5927d53d0..b4e5d0956 100644
--- a/crates/ide-language/src/registry.rs
+++ b/crates/ide-language/src/registry.rs
@@ -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"),
diff --git a/languages/arduino.toml b/languages/arduino.toml
new file mode 100644
index 000000000..a8165a1b4
--- /dev/null
+++ b/languages/arduino.toml
@@ -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"
diff --git a/src/ui/icons.tsx b/src/ui/icons.tsx
index 61bad8011..8368918a5 100644
--- a/src/ui/icons.tsx
+++ b/src/ui/icons.tsx
@@ -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",