You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TLDR: I propose automatically generating the book/src/editor.md page by moving the documentation from there into helix-view/src/ui/editor.rs doc comments.
Then generating markdown from these doc comments.
Helix currently has documentation for the some of same things in 2 different places:
in the source code as doc comments
in markdown, in the book
Some of the documentation is automatically generated, but not all of it. For example, consider this FilePickerConfig:
#[derive(Debug,Clone,PartialEq,Eq,Serialize,Deserialize)]#[serde(rename_all = "kebab-case",default, deny_unknown_fields)]pubstructFilePickerConfig{/// IgnoreOptions/// Enables ignoring hidden files./// Whether to hide hidden files in file picker and global search results. Defaults to true.pubhidden:bool,/// Enables following symlinks./// Whether to follow symbolic links in file picker and file or directory completions. Defaults to true.pubfollow_symlinks:bool,/// Hides symlinks that point into the current directory. Defaults to true.pubdeduplicate_links:bool,/// Enables reading ignore files from parent directories. Defaults to true.pubparents:bool,/// Enables reading `.ignore` files./// Whether to hide files listed in .ignore in file picker and global search results. Defaults to true.pubignore:bool,/// Enables reading `.gitignore` files./// Whether to hide files listed in .gitignore in file picker and global search results. Defaults to true.pubgit_ignore:bool,/// Enables reading global .gitignore, whose path is specified in git's config: `core.excludefile` option./// Whether to hide files listed in global .gitignore in file picker and global search results. Defaults to true.pubgit_global:bool,/// Enables reading `.git/info/exclude` files./// Whether to hide files listed in .git/info/exclude in file picker and global search results. Defaults to true.pubgit_exclude:bool,/// WalkBuilder options/// Maximum Depth to recurse directories in file picker and global search. Defaults to `None`.pubmax_depth:Option<usize>,}
Which has the following markdown documentation:
### `[editor.file-picker]` Section
Set options for file picker and global search. Ignoring a file means it is
not visible in the Helix file picker and global search.
All git related options are only enabled in a git repository.
| Key | Description | Default ||--|--|---------|
|`hidden` | Enables ignoring hidden files | `true`
|`follow-symlinks` | Follow symlinks instead of ignoring them | `true`
|`deduplicate-links` | Ignore symlinks that point at files already shown in the picker | `true`
|`parents` | Enables reading ignore files from parent directories | `true`
|`ignore` | Enables reading `.ignore` files | `true`
|`git-ignore` | Enables reading `.gitignore` files | `true`
|`git-global` | Enables reading global `.gitignore`, whose path is specified in git's config: `core.excludesfile` option | `true`
|`git-exclude` | Enables reading `.git/info/exclude` files | `true`
|`max-depth` | Set with an integer value for maximum depth to recurse | Unset by default
Ignore files can be placed locally as `.ignore` or put in your home directory as `~/.ignore`. They support the usual ignore and negative ignore (unignore) rules used in `.gitignore` files.
Additionally, you can use Helix-specific ignore files by creating a local `.helix/ignore` file in the current workspace or a global `ignore` file located in your Helix config directory:
- Linux and Mac: `~/.config/helix/ignore`- Windows: `%AppData%\helix\ignore`
Example:
```ini# unignore in file picker and global search
!.github/
!.gitignore
!.gitattributes
```
We could generate that markdown documentation using a crate like documented. To do that, merge the markdown documentation with the source code doc comments:
/// Set options for file picker and global search. Ignoring a file means it is/// not visible in the Helix file picker and global search.////// All git related options are only enabled in a git repository.////// {{#include ./generated/file-picker-config-options.md}}////// Ignore files can be placed locally as `.ignore` or put in your home directory as `~/.ignore`. They support the usual ignore and negative ignore (unignore) rules used in `.gitignore` files.////// Additionally, you can use Helix-specific ignore files by creating a local `.helix/ignore` file in the current workspace or a global `ignore` file located in your Helix config directory:/// - Linux and Mac: `~/.config/helix/ignore`/// - Windows: `%AppData%\helix\ignore`////// Example:////// ```ini/// # unignore in file picker and global search/// !.github//// !.gitignore/// !.gitattributes/// ```#[cfg_attr(doc_gen, derive(Documented,DocumentedFields))]#[derive(Debug,Clone,PartialEq,Eq,Serialize,Deserialize)]#[serde(rename_all = "kebab-case",default, deny_unknown_fields)]pubstructFilePickerConfig{/// IgnoreOptions/// Enables ignoring hidden files./// Whether to hide hidden files in file picker and global search results. Defaults to true.pubhidden:bool,/// Enables following symlinks./// Whether to follow symbolic links in file picker and file or directory completions. Defaults to true.pubfollow_symlinks:bool,/// Hides symlinks that point into the current directory. Defaults to true.pubdeduplicate_links:bool,/// Enables reading ignore files from parent directories. Defaults to true.pubparents:bool,/// Enables reading `.ignore` files./// Whether to hide files listed in .ignore in file picker and global search results. Defaults to true.pubignore:bool,/// Enables reading `.gitignore` files./// Whether to hide files listed in .gitignore in file picker and global search results. Defaults to true.pubgit_ignore:bool,/// Enables reading global .gitignore, whose path is specified in git's config: `core.excludefile` option./// Whether to hide files listed in global .gitignore in file picker and global search results. Defaults to true.pubgit_global:bool,/// Enables reading `.git/info/exclude` files./// Whether to hide files listed in .git/info/exclude in file picker and global search results. Defaults to true.pubgit_exclude:bool,/// WalkBuilder options/// Maximum Depth to recurse directories in file picker and global search. Defaults to `None`.pubmax_depth:Option<usize>,}
In cargo xtask docgen, Helix will be compiled with the #[cfg(doc_gen)]. This allows us to have documentation in just 1 place
Soon that Helix will support showing markdown syntax highlighting in documentation comments, this will make reading the documentation from source code just as good as reading it from the markdown file.
This discussion was converted from issue #13163 on March 22, 2025 17:48.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TLDR: I propose automatically generating the
book/src/editor.md
page by moving the documentation from there intohelix-view/src/ui/editor.rs
doc comments.Then generating markdown from these doc comments.
Helix currently has documentation for the some of same things in 2 different places:
Some of the documentation is automatically generated, but not all of it. For example, consider this
FilePickerConfig
:Which has the following markdown documentation:
We could generate that markdown documentation using a crate like
documented
. To do that, merge the markdown documentation with the source code doc comments:In
cargo xtask docgen
, Helix will be compiled with the#[cfg(doc_gen)]
. This allows us to have documentation in just 1 placeSoon that Helix will support showing markdown syntax highlighting in documentation comments, this will make reading the documentation from source code just as good as reading it from the markdown file.
Beta Was this translation helpful? Give feedback.
All reactions