livebook/assets/js/cell/live_editor/elixir/language_configuration.js
Jonatan Kłosko 936d0af5fb
Set up markdown rendering (#16)
* Set up markdown rendering, update theme.

* Improve focus and handle expanding for markdown cells

* Add keybindings for expanding/navigating cells

* Improve editor autofocus when navigating with shortcuts

* Add tests

* Render markdown on the client

* Don't render cell initial data and make a request instead
2021-01-30 00:33:04 +01:00

37 lines
984 B
JavaScript

/**
* Defines Elixir traits to enable various editor features,
* like automatic bracket insertion and indentation.
*/
const ElixirLanguageConfiguration = {
comments: {
lineComment: "#",
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"],
],
surroundingPairs: [
["{", "}"],
["[", "]"],
["(", ")"],
["'", "'"],
['"', '"'],
],
autoClosingPairs: [
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["comment"] },
{ open: '"""', close: '"""' },
{ open: "`", close: "`", notIn: ["string", "comment"] },
{ open: "(", close: ")" },
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "<<", close: ">>" },
],
indentationRules: {
increaseIndentPattern: /^\s*(after|else|catch|rescue|fn|[^#]*(do|<\-|\->|\{|\[|\=))\s*$/,
decreaseIndentPattern: /^\s*((\}|\])\s*$|(after|else|catch|rescue|end)\b)/,
},
};
export default ElixirLanguageConfiguration;