Skip to content

Commit

Permalink
Elixir language support
Browse files Browse the repository at this point in the history
  • Loading branch information
jc00ke authored and heyman committed Jan 4, 2025
1 parent 82494d8 commit 30d9817
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Available for Mac, Windows, and Linux.
- Block-based
- Syntax highlighting:

C++, C#, Clojure, CSS, Erlang, Dart, Go, Groovy, HTML, Java, JavaScript, JSX, Kotlin, TypeScript, TOML, TSX, JSON, Lezer, Markdown, PHP, Python, Ruby, Rust, Scala, Shell, SQL, Swift, Vue, XML, YAML
C++, C#, Clojure, CSS, Elixir, Erlang, Dart, Go, Groovy, HTML, Java, JavaScript, JSX, Kotlin, TypeScript, TOML, TSX, JSON, Lezer, Markdown, PHP, Python, Ruby, Rust, Scala, Shell, SQL, Swift, Vue, XML, YAML

- Language auto-detection
- Auto-formatting
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/node": "^20.10.5",
"@vitejs/plugin-vue": "^4.0.0",
"codemirror-lang-elixir": "^4.0.0",
"debounce": "^1.2.1",
"electron": "^31.1.0",
"electron-builder": "^23.6.0",
"electron-builder-notarize": "^1.5.1",
"electron-store": "^8.1.0",
"electron-updater": "^6.1.7",
"fs-jetpack": "^5.1.0",
"lezer-elixir": "^1.1.2",
"prettier": "^3.3.2",
"rollup-plugin-license": "^3.0.1",
"sass": "^1.57.1",
Expand Down
2 changes: 1 addition & 1 deletion public/langdetect-worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
importScripts("guesslang.min.js")

GUESSLANG_LANGUAGES = ["json","py","html","sql","md","java","php","css","xml","cpp","rs","cs","rb","sh","yaml","toml","go","clj","erl","js","ts","swift","kt","groovy","ps1","dart","scala"]
GUESSLANG_LANGUAGES = ["json","py","html","sql","md","java","php","css","xml","cpp","rs","cs","rb","sh","yaml","toml","go","clj","ex","erl","js","ts","swift","kt","groovy","ps1","dart","scala"]

const guessLang = new self.GuessLang()

Expand Down
2 changes: 1 addition & 1 deletion src/editor/lang-heynote/heynote.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ NoteDelimiter {

@tokens {
noteDelimiterMark { "∞∞∞" }
NoteLanguage { "text" | "math" | "javascript" | "typescript" | "jsx" | "tsx" | "json" | "python" | "html" | "sql" | "markdown" | "java" | "php" | "css" | "xml" | "cpp" | "rust" | "csharp" | "ruby" | "shell" | "yaml" | "golang" | "clojure" | "erlang" | "lezer" | "toml" | "swift" | "kotlin" | "groovy" | "diff" | "powershell" | "vue" | "dart" | "scala" }
NoteLanguage { "text" | "math" | "javascript" | "typescript" | "jsx" | "tsx" | "json" | "python" | "html" | "sql" | "markdown" | "java" | "php" | "css" | "xml" | "cpp" | "rust" | "csharp" | "ruby" | "shell" | "yaml" | "golang" | "clojure" | "elixir" | "erlang" | "lezer" | "toml" | "swift" | "kotlin" | "groovy" | "diff" | "powershell" | "vue" | "dart" | "scala" }
Auto { "-a" }
noteDelimiterEnter { "\n" }
//NoteContent { String }
Expand Down
1 change: 1 addition & 0 deletions src/editor/lang-heynote/nested-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { markdownLanguage } from "@codemirror/lang-markdown"
import { javaLanguage } from "@codemirror/lang-java"
import { lezerLanguage } from "@codemirror/lang-lezer"
import { phpLanguage } from "@codemirror/lang-php"
import { elixirLanguage } from "codemirror-lang-elixir"

import { NoteContent, NoteLanguage } from "./parser.terms.js"
import { LANGUAGES } from "../languages.js"
Expand Down
2 changes: 1 addition & 1 deletion src/editor/lang-heynote/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const parser = LRParser.deserialize({
maxT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RP#[#],U~,XP#c#d(o~,_P#i#j,b~,eQ#U#V&u#g#h$k~,nS#V#W,z#[#]+l#e#f'X#k#l-^~,}P#T#U-Q~-TP#`#a-W~-ZP#T#U#j~-aP#]#^-d~-gP#Y#Z$k~-mS#X#Y-y#c#d'R#g#h.P#m#n.V~-|P#l#m$k~.SP#l#m#j~.YP#d#e.]~.`P#X#Y.c~.fP#g#h'|~.lP#i#j#d~.rP#T#U'R~.xP%&x%&y.{~/OP%&x%&y/R~/WOY~",
tokenizers: [0, noteContent],
topRules: {"Document":[0,2]},
tokenPrec: 0
Expand Down
7 changes: 7 additions & 0 deletions src/editor/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { shell } from "@codemirror/legacy-modes/mode/shell"
import { yaml } from "@codemirror/legacy-modes/mode/yaml"
import { go } from "@codemirror/legacy-modes/mode/go"
import { clojure } from "@codemirror/legacy-modes/mode/clojure"
import { elixirLanguage } from "codemirror-lang-elixir"
import { erlang } from "@codemirror/legacy-modes/mode/erlang"
import { toml } from "@codemirror/legacy-modes/mode/toml"
import { swift } from "@codemirror/legacy-modes/mode/swift"
Expand Down Expand Up @@ -190,6 +191,12 @@ export const LANGUAGES = [
parser: StreamLanguage.define(clojure).parser,
guesslang: "clj",
}),
new Language({
token: "elixir",
name: "Elixir",
parser: elixirLanguage.parser,
guesslang: "ex",
}),
new Language({
token: "erlang",
name: "Erlang",
Expand Down

0 comments on commit 30d9817

Please sign in to comment.