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:
Ilya Landmushketer888 authored and GitHub committed 2026-11-07 11:12:32 +08:00
1 parent ee6786d573
commit 1af1744290
3 files changed
+13 -1

No files matched your search

+2
View File
@@ -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"),
+10
View File
@@ -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
View File
@@ -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",