Skip to content

Commit 4cee9e5

Browse files
committed
Merge branch 'develop'
2 parents c3c5304 + 51060b0 commit 4cee9e5

File tree

10 files changed

+793
-536
lines changed

10 files changed

+793
-536
lines changed

README.md

Lines changed: 164 additions & 536 deletions
Large diffs are not rendered by default.

docs/autocomplete.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Auto Complete
2+
3+
The auto-complete plugin is in charge of providing suggestions for code-completion and signature help.
4+
5+
### Auto Complete config object keys
6+
7+
* **max_label_characters**: Maximum characters displayed in the suggestion box.
8+
* **suggestions_syntax_highlight**: Enables/disables syntax highlighting in suggestions.
9+
10+
### Auto Complete keybindings object keys
11+
12+
* **autocomplete-close-signature-help**: Closes the signature help
13+
* **autocomplete-close-suggestion**: Closes the suggestions
14+
* **autocomplete-first-suggestion**: Moves to the first suggestion in the auto complete list
15+
* **autocomplete-last-suggestion**: Moves to the last suggestion in the auto complete list
16+
* **autocomplete-next-signature-help**: Moves to the next signature help
17+
* **autocomplete-next-suggestion**: Moves to the next suggestion
18+
* **autocomplete-next-suggestion-page**: Moves to the next page of suggestions
19+
* **autocomplete-pick-suggestion**: Picks a suggestion
20+
* **autocomplete-pick-suggestion-alt**: Picks a suggestion (alternative keybinding)
21+
* **autocomplete-pick-suggestion-alt-2**: Picks a suggestion (alternative keybinding)
22+
* **autocomplete-prev-signature-help**: Moves to the previous signature help
23+
* **autocomplete-prev-suggestion**: Moves to the previous suggestion
24+
* **autocomplete-prev-suggestion-page**: Moves to the previous suggestion page
25+
* **autocomplete-update-suggestions**: Request to display or update currently displayed suggestions (if possible)

docs/customlanguages.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
## Custom languages support
2+
3+
Custom languages support can be added in the languages directory found at:
4+
5+
* *Linux*: uses `XDG_CONFIG_HOME`, usually translates to `~/.config/ecode/languages`
6+
* *macOS*: uses `Application Support` folder in `HOME`, usually translates to `~/Library/Application Support/ecode/languages`
7+
* *Windows*: uses `APPDATA`, usually translates to `C:\Users\{username}\AppData\Roaming\ecode\languages`
8+
9+
ecode will read each file located at that directory with `json` extension. Each file can contain one
10+
or several languages. In order to set several languages the root element of the json file should be
11+
an array, containing one object for each language, otherwise if the root element is an object, it
12+
should contain the language definition. Language definitions can override any currently supported
13+
definition. ecode will prioritize user defined definitions.
14+
15+
### Language definition format
16+
17+
```json
18+
{
19+
"name": "language_name",
20+
"files": [ "Array of file extensions supported" ],
21+
"comment": "Sets the comment string used for auto-comment functionality.",
22+
"patterns": [
23+
{ "pattern": "lua_pattern", "type": "type_name" },
24+
{ "pattern": "no_capture(pattern_capture_1)(pattern_capture_2)", "type": { "no_capture_type_name", "capture_1_type_name", "capture_2_type_name" } },
25+
{ "pattern": ["lua_pattern_start", "lua_pattern_end", "escape_character"], "type": "type_name" }
26+
{ "regex": "perl_regex", "type": "type_name" },
27+
{ "regex": "no_capture(pattern_capture_1)(pattern_capture_2)", "type": { "no_capture_type_name", "capture_1_type_name", "capture_2_type_name" } },
28+
{ "regex": ["regex_start", "regex_end", "escape_character"], "type": "type_name" }
29+
],
30+
"symbols": [
31+
{ "symbol_name": "type_name" }
32+
],
33+
"visible": true, /* sets if the language is visible as a main language in the editor, optional parameter, true by default */
34+
"auto_close_xml_tag": false, /* sets if the language defined supports auto close XML tags, optional parameter, false by default */
35+
"lsp_name": "sets the LSP name assigned for the language, optional parameter, it will use the _name_ in lowercase if not set"
36+
}
37+
```
38+
39+
### Porting language definitions
40+
41+
ecode uses the same format for language definition as [lite](https://github.com/rxi/lite) and [lite-xl](https://github.com/lite-xl/lite-xl) editors.
42+
This makes much easier to add new languages to ecode. There's also a helper tool that can be download from
43+
ecode repository located [here](https://github.com/SpartanJ/ecode/tree/develop/tools/data-migration/lite/language)
44+
that allows to directly export a lite language definition to the JSON file format used in ecode.
45+
46+
### Extending language definitions
47+
48+
It's possible to easily extend any language definition by exporting it using the CLI arguments provided:
49+
`--export-lang` and `--export-lang-path`. A user wanting to extend or improve a language definition can
50+
export it, modify it and install the definition with a `.json` extension in the [custom languages path](#custom-languages-support).
51+
For example, to extend the language `vue` you will need to run:
52+
`ecode --export-lang=vue --export-lang-path=./vue.json`, exit the exported file and move it to the
53+
[custom languages path](#custom-languages-support).
54+
55+
### Language definition example
56+
57+
```json
58+
{
59+
"name": "Elixir",
60+
"files": [ "%.ex$", "%.exs$" ],
61+
"comment": "#",
62+
"patterns": [
63+
{ "pattern": "#.*\n", "type": "comment" },
64+
{ "pattern": [ ":\"", "\"", "\\" ], "type": "number" },
65+
{ "pattern": [ "\"\"\"", "\"\"\"", "\\" ], "type": "string" },
66+
{ "pattern": [ "\"", "\"", "\\" ], "type": "string" },
67+
{ "pattern": [ "'", "'", "\\" ], "type": "string" },
68+
{ "pattern": [ "~%a[/\"|'%(%[%{<]", "[/\"|'%)%]%}>]", "\\" ], "type": "string"},
69+
{ "pattern": "-?0x%x+", "type": "number" },
70+
{ "pattern": "-?%d+[%d%.eE]*f?", "type": "number" },
71+
{ "pattern": "-?%.?%d+f?", "type": "number" },
72+
{ "pattern": ":\"?[%a_][%w_]*\"?", "type": "number" },
73+
{ "pattern": "[%a][%w_!?]*%f[(]", "type": "function" },
74+
{ "pattern": "%u%w+", "type": "normal" },
75+
{ "pattern": "@[%a_][%w_]*", "type": "keyword2" },
76+
{ "pattern": "_%a[%w_]*", "type": "keyword2" },
77+
{ "pattern": "[%+%-=/%*<>!|&]", "type": "operator" },
78+
{ "pattern": "[%a_][%w_]*", "type": "symbol" }
79+
],
80+
"symbols": [
81+
{"def": "keyword"},
82+
{"defp": "keyword"},
83+
{"defguard": "keyword"},
84+
{"defguardp": "keyword"},
85+
{"defmodule": "keyword"},
86+
{"defprotocol": "keyword"},
87+
{"defimpl": "keyword"},
88+
{"defrecord": "keyword"},
89+
{"defrecordp": "keyword"},
90+
{"defmacro": "keyword"},
91+
{"defmacrop": "keyword"},
92+
{"defdelegate": "keyword"},
93+
{"defoverridable": "keyword"},
94+
{"defexception": "keyword"},
95+
{"defcallback": "keyword"},
96+
{"defstruct": "keyword"},
97+
{"for": "keyword"},
98+
{"case": "keyword"},
99+
{"when": "keyword"},
100+
{"with": "keyword"},
101+
{"cond": "keyword"},
102+
{"if": "keyword"},
103+
{"unless": "keyword"},
104+
{"try": "keyword"},
105+
{"receive": "keyword"},
106+
{"after": "keyword"},
107+
{"raise": "keyword"},
108+
{"rescue": "keyword"},
109+
{"catch": "keyword"},
110+
{"else": "keyword"},
111+
{"quote": "keyword"},
112+
{"unquote": "keyword"},
113+
{"super": "keyword"},
114+
{"unquote_splicing": "keyword"},
115+
{"do": "keyword"},
116+
{"end": "keyword"},
117+
{"fn": "keyword"},
118+
{"import": "keyword2"},
119+
{"alias": "keyword2"},
120+
{"use": "keyword2"},
121+
{"require": "keyword2"},
122+
{"and": "operator"},
123+
{"or": "operator"},
124+
{"true": "literal"},
125+
{"false": "literal"},
126+
{"nil": "literal"}
127+
]
128+
}
129+
```
130+
131+
For more complex syntax definitions please see the definition of all the native languages supported
132+
by ecode [here](https://github.com/SpartanJ/eepp/tree/develop/src/eepp/ui/doc/languages) and
133+
[here](https://github.com/SpartanJ/eepp/tree/develop/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages).

docs/debugger.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
## Debugger
2+
3+
*ecode* implements the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol) (DAP) for debugger support. This enables seamless debugging integration with various languages through a common protocol. DAP is used by VS Code and other major editors and has been implemented for a wide range of programming languages. For more information, see the [list of implementations](https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/).
4+
5+
Initially, *ecode* provides support for some of the most common debug adapter implementations, with plans to add support for more languages in future updates.
6+
7+
### How It Works
8+
9+
There are two ways to use the debugger in *ecode*:
10+
11+
1. **Using Default *ecode* Configurations:** These configurations are designed to work seamlessly with your build settings. The executable used in these default options is the `Run Target` of your currently selected `Build Configuration`.
12+
13+
2. **Using Custom Launch Configurations:** Users can provide custom launch configurations within the project folder. These configurations should be located at `.ecode/launch.json` or `.vscode/launch.json`. *ecode* uses the same `launch.json` format as VS Code, ensuring compatibility for users migrating from other DAP-based editors. However, *ecode* will only recognize currently supported debuggers, as DAP implementations can vary significantly in configuration details.
14+
15+
### Using *ecode* Default Configurations
16+
17+
Once you have a `Build Configuration` with a selected `Run Target`, this will be used for the default `Launch` and `Attach` configurations for your language.
18+
19+
- **Launch Configurations:** These configurations start an executable from your local environment, with the process managed by the debugger. This is the most common setup for most users. To use it:
20+
21+
- Ensure your `Run Target` is ready.
22+
- Go to the `Debugger` tab in the Side Panel.
23+
- Select the debugger based on the language you want to debug. For example, C or C++ binaries can be debugged using `gdb` or `lldb-dap` (also known as `lldb-vscode`), depending on your platform.
24+
- Choose the appropriate `Debugger Configuration`, such as `Launch Binary`.
25+
- Click `Debug` or press `Ctrl/Cmd + F5` to start debugging.
26+
27+
- **Attach Configurations:** These configurations allow the debugger to attach to an already running process, either locally or remotely. You can attach to a process via its process ID or its binary name/path. Some configurations include a `(wait)` option, which waits for the process to start before attaching.
28+
29+
The default `Attach to Binary` option will also use the current `Run Target` to execute the binary. Unlike the `Launch` configuration, here the process is managed by *ecode* instead of the debugger. This feature is particularly useful for debugging CLI programs from the terminal if the `Run Target` is configured with `Run in Terminal`.
30+
31+
### Using Custom Launch Configurations
32+
33+
*ecode* supports custom launch configurations through the `launch.json` file, which can be placed in either the `.ecode/` or `.vscode/` folder within your project directory. This format is fully compatible with VS Code, making it easy for users transitioning from other editors.
34+
35+
#### Creating a `launch.json` File
36+
37+
The `launch.json` file defines how debugging sessions are launched or attached. A basic configuration looks like this:
38+
39+
```json
40+
{
41+
"version": "0.2.0",
42+
"configurations": [
43+
{
44+
"name": "Launch Program",
45+
"type": "lldb",
46+
"request": "launch",
47+
"program": "${workspaceFolder}/bin/myapp",
48+
"args": ["--verbose"],
49+
"cwd": "${workspaceFolder}",
50+
"stopOnEntry": false
51+
}
52+
]
53+
}
54+
```
55+
56+
#### Key Fields Explained
57+
58+
- **`name`**: The display name for the configuration in the *ecode* debugger interface.
59+
- **`type`**: The debugger type, such as `gdb`, `lldb`, or any supported DAP adapter.
60+
- **`request`**: Specifies whether to `launch` a new process or `attach` to an existing one.
61+
- **`program`**: The path to the executable you want to debug.
62+
- **`args`**: Optional. Command-line arguments passed to the program.
63+
- **`cwd`**: The working directory for the program.
64+
- **`stopOnEntry`**: Optional. If `true`, the debugger will pause at the program's entry point.
65+
66+
#### Advanced Customization
67+
68+
You can create multiple configurations for different scenarios, such as:
69+
70+
- Attaching to a remote process:
71+
72+
```json
73+
{
74+
"name": "Attach to Remote",
75+
"type": "gdb",
76+
"request": "attach",
77+
"host": "192.168.1.100",
78+
"port": 1234
79+
}
80+
```
81+
82+
- Debugging with environment variables:
83+
84+
```json
85+
{
86+
"name": "Launch with Env Vars",
87+
"type": "lldb",
88+
"request": "launch",
89+
"program": "${workspaceFolder}/bin/myapp",
90+
"env": {
91+
"DEBUG": "1",
92+
"LOG_LEVEL": "verbose"
93+
}
94+
}
95+
```
96+
97+
*ecode* will automatically detect and load configurations from `launch.json`, prioritizing `.ecode/launch.json` if both are present. This approach ensures flexibility and consistency across projects, whether you're starting fresh or migrating from VS Code.
98+
99+
*ecode* supports the same `launch.json` schema as VS Code, including standard input types such as:
100+
101+
- **`pickProcess`**: Prompts the user to select a running process from a list. This is useful for attaching the debugger to an already running application.
102+
- **`pickString`**: Allows the user to select from a predefined list of string options.
103+
- **`promptString`**: Prompts the user to manually enter a string value, useful for dynamic input during debugging sessions.
104+
105+
In addition to these standard inputs, *ecode* extends functionality with an extra input type:
106+
107+
- **`pickFile`**: This *ecode*-specific input allows users to select a binary file directly from the file system. It is particularly useful when you need to choose an executable to be run and debugged without hardcoding the path in your `launch.json`.
108+
109+
These input options make custom configurations flexible and dynamic, adapting to different debugging workflows and environments.
110+
111+
#### Variables Reference
112+
113+
ecode supports all vscode variable substitution in debugger configuration files. Variable substitution is supported inside some key and value strings in `launch.json` files using **${variableName}** syntax.
114+
115+
##### Predefined variables
116+
117+
The following predefined variables are supported:
118+
119+
- **${userHome}** - the path of the user's home folder
120+
- **${workspaceFolder}** - the path of the folder opened in VS Code
121+
- **${workspaceFolderBasename}** - the name of the folder opened in VS Code without any slashes (/)
122+
- **${file}** - the current opened file
123+
- **${fileWorkspaceFolder}** - the current opened file's workspace folder
124+
- **${relativeFile}** - the current opened file relative to `workspaceFolder`
125+
- **${relativeFileDirname}** - the current opened file's dirname relative to `workspaceFolder`
126+
- **${fileBasename}** - the current opened file's basename
127+
- **${fileBasenameNoExtension}** - the current opened file's basename with no file extension
128+
- **${fileExtname}** - the current opened file's extension
129+
- **${fileDirname}** - the current opened file's folder path
130+
- **${fileDirnameBasename}** - the current opened file's folder name
131+
- **${cwd}** - the task runner's current working directory upon the startup of VS Code
132+
- **${lineNumber}** - the current selected line number in the active file
133+
- **${selectedText}** - the current selected text in the active file
134+
- **${execPath}** - the path to the running VS Code executable
135+
- **${defaultBuildTask}** - the name of the default build task
136+
- **${pathSeparator}** - the character used by the operating system to separate components in file paths
137+
- **${/}** - shorthand for **${pathSeparator}**
138+
139+
### Language-Specific Configurations
140+
141+
In addition to general configurations, *ecode* offers language-specific settings, such as loading core dumps. Each debugger and language may provide different configurations based on the debugger's capabilities and the language's characteristics.
142+
143+
### Debugger keybindings object keys
144+
145+
* **debugger-breakpoint-enable-toggle**: Toggles enable/disable current line breakpoint (if any)
146+
* **debugger-breakpoint-toggle**: Toggles breakpoint in current line
147+
* **debugger-continue-interrupt**: If debugger is running: continues or interrupt the current execution. If debugger is not running builds and run the debugger.
148+
* **debugger-start**: Starts the debugger
149+
* **debugger-start-stop**: Starts or stops the debugger (depending on its current status)
150+
* **debugger-step-into**: Steps into the current debugged line
151+
* **debugger-step-out**: Steps out the current debugged line
152+
* **debugger-step-over**: Steps over the current debugged line
153+
* **debugger-stop**: Stops the debugger
154+
* **toggle-status-app-debugger**: Opens/hides the debugger status bar panel
155+
156+
### Debugger config object keys
157+
158+
* **fetch_globals**: Enable/Disable if global variables should be fetched automatically (when available)
159+
* **fetch_registers**: Enable/Disable if registers should be fetched automatically (when available)
160+
* **silent**: Enable/Disable non-critical Debugger logs

docs/formatter.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Auto Formatter
2+
3+
The formatter plugin works exactly like the linter plugin, but it will execute tools that auto-format code.
4+
*ecode* provides support for several languages by default with can be extended easily by expanding the
5+
`formatters.json` configuration. `formatters.json` default configuration can be obtained from [here](https://raw.githubusercontent.com/SpartanJ/eepp/develop/bin/assets/plugins/formatters.json).
6+
It also supports some formatters natively, this means that the formatter comes with ecode without requiring any external dependency.
7+
And also supports LSP text document formatting, meaning that if you're running an LSP that supports formatting documents, formatting will be available too.
8+
To configure new formatters you can create a new `formatters.json` file in the [default configuration path](#plugins-configuration-files-location) of *ecode*.
9+
10+
### `formatters.json` format
11+
12+
```json
13+
{
14+
"config": {
15+
"auto_format_on_save": false
16+
},
17+
"keybindings": {
18+
"format-doc": "alt+f"
19+
},
20+
"formatters": [
21+
{
22+
"file_patterns": ["%.js$", "%.ts$"],
23+
"command": "prettier $FILENAME"
24+
}
25+
]
26+
}
27+
```
28+
29+
### Currently supported formatters
30+
31+
Please check the [language support table](#language-support-table)
32+
33+
### Formatter config object keys
34+
35+
* **auto_format_on_save**: Indicates if after saving the file it should be auto-formatted
36+
37+
### Formatter keybindings object keys
38+
39+
* **format-doc**: Keybinding to format the doc with the configured language formatter
40+
41+
### Formatter JSON object keys
42+
43+
* **file_patterns**: Array of [Lua Patterns](https://www.lua.org/manual/5.4/manual.html#6.4.1) representing the file extensions that must use the formatter
44+
* **command**: The command to execute to run the formatter. $FILENAME represents the file path
45+
* **type**: Indicates the mode that which the formatter outputs the results. Supported two possible options: "inplace" (file is replaced with the formatted version), "output" (newly formatted file is the stdout of the program, default option) or "native" (uses the formatter provided by ecode)
46+
* **url** (optional): The web page URL of the formatter

0 commit comments

Comments
 (0)