Skip to content

Commit

Permalink
Merge branch 'master' into fix-windows-paths
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Mar 30, 2023
2 parents 0a5fd2a + 5b3dd6a commit 80db69f
Show file tree
Hide file tree
Showing 116 changed files with 3,865 additions and 1,324 deletions.
216 changes: 118 additions & 98 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ You can use a custom configuration file by specifying it with the `-c` or
Additionally, you can reload the configuration file by sending the USR1
signal to the Helix process on Unix operating systems, such as by using the command `pkill -USR1 hx`.

Finally, you can have a `config.toml` local to a project by putting it under a `.helix` directory in your repository.
Its settings will be merged with the configuration directory `config.toml` and the built-in configuration.

## Editor

### `[editor]` Section
Expand All @@ -53,10 +56,12 @@ signal to the Helix process on Unix operating systems, such as by using the comm
| `completion-replace` | Set to `true` to make completions always replace the entire word and not just the part before the cursor | `false` |
| `auto-info` | Whether to display info boxes | `true` |
| `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative | `false` |
| `undercurl` | Set to `true` to override automatic detection of terminal undercurl support in the event of a false negative | `false` |
| `rulers` | List of column positions at which to display the rulers. Can be overridden by language specific `rulers` in `languages.toml` file | `[]` |
| `bufferline` | Renders a line at the top of the editor displaying open buffers. Can be `always`, `never` or `multiple` (only shown if more than one buffer is in use) | `never` |
| `color-modes` | Whether to color the mode indicator with different colors depending on the mode itself | `false` |
| `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap_at_text_width` is set | `80` |
| `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml` | `[]` |

### `[editor.statusline]` Section

Expand Down Expand Up @@ -304,7 +309,7 @@ Example:
min-width = 1
```

#### `[editor.gutters.diagnotics]` Section
#### `[editor.gutters.diagnostics]` Section

Currently unused

Expand Down
9 changes: 7 additions & 2 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
| c |||| `clangd` |
| c-sharp ||| | `OmniSharp` |
| cairo || | | |
| capnp || || |
| clojure || | | `clojure-lsp` |
| cmake |||| `cmake-language-server` |
| comment || | | |
Expand Down Expand Up @@ -40,7 +41,7 @@
| fortran || || `fortls` |
| gdscript |||| |
| git-attributes || | | |
| git-commit || | | |
| git-commit || | | |
| git-config || | | |
| git-ignore || | | |
| git-rebase || | | |
Expand Down Expand Up @@ -87,6 +88,7 @@
| msbuild || || |
| nasm ||| | |
| nickel || || `nls` |
| nim |||| `nimlangserver` |
| nix || | | `nil` |
| nu || | | |
| ocaml || || `ocamllsp` |
Expand All @@ -111,6 +113,7 @@
| r || | | `R` |
| racket || | | `racket` |
| regex || | | |
| rego || | | `regols` |
| rescript ||| | `rescript-language-server` |
| rmarkdown || || `R` |
| ron || || |
Expand All @@ -122,6 +125,7 @@
| scheme || | | |
| scss || | | `vscode-css-language-server` |
| slint || || `slint-lsp` |
| smithy || | | `cs` |
| sml || | | |
| solidity || | | `solc` |
| sql || | | |
Expand All @@ -140,9 +144,10 @@
| typescript |||| `typescript-language-server` |
| ungrammar || | | |
| uxntal || | | |
| v || | | `v` |
| v || | | `v` |
| vala || | | `vala-language-server` |
| verilog ||| | `svlangserver` |
| vhdl || | | `vhdl_ls` |
| vhs || | | |
| vue || | | `vls` |
| wast || | | |
Expand Down
1 change: 1 addition & 0 deletions book/src/generated/typable-cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
| `:tree-sitter-subtree`, `:ts-subtree` | Display tree sitter subtree under cursor, primarily for debugging queries. |
| `:config-reload` | Refresh user config. |
| `:config-open` | Open the user config.toml file. |
| `:config-open-workspace` | Open the workspace config.toml file. |
| `:log-open` | Open the helix log file. |
| `:insert-output` | Run shell command, inserting output before each selection. |
| `:append-output` | Run shell command, appending output after each selection. |
Expand Down
11 changes: 11 additions & 0 deletions book/src/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Fedora/RHEL](#fedorarhel)
- [Arch Linux community](#arch-linux-community)
- [NixOS](#nixos)
- [AppImage](#appimage)
- [macOS](#macos)
- [Homebrew Core](#homebrew-core)
- [Windows](#windows)
Expand Down Expand Up @@ -87,6 +88,16 @@ accepts the new settings on first use.
If you are using a version of Nix without flakes enabled,
[install Cachix CLI](https://docs.cachix.org/installation) and use
`cachix use helix` to configure Nix to use cached outputs when possible.

### AppImage

Install Helix using [AppImage](https://appimage.org/).
Download Helix AppImage from the [latest releases](https://github.com/helix-editor/helix/releases/latest) page.

```sh
chmod +x helix-*.AppImage # change permission for executable mode
./helix-*.AppImage # run helix
```

## macOS

Expand Down
1 change: 1 addition & 0 deletions book/src/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ These configuration keys are available:
| `grammar` | The tree-sitter grammar to use (defaults to the value of `name`) |
| `formatter` | The formatter for the language, it will take precedence over the lsp when defined. The formatter must be able to take the original file as input from stdin and write the formatted file to stdout |
| `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap_at_text_width` is set, defaults to `editor.text-width` |
| `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml`. Overwrites the setting of the same name in `config.toml` if set. |

### File-type detection and the `file-types` key

Expand Down
6 changes: 6 additions & 0 deletions book/src/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ We use a similar set of scopes as
- `list`
- `unnumbered`
- `numbered`
- `checked`
- `unchecked`
- `bold`
- `italic`
- `strikethrough`
Expand Down Expand Up @@ -276,8 +278,11 @@ These scopes are used for theming the editor interface:
| `ui.cursor.primary.normal` | |
| `ui.cursor.primary.insert` | |
| `ui.cursor.primary.select` | |
| `ui.debug.breakpoint` | Breakpoint indicator, found in the gutter |
| `ui.debug.active` | Indicator for the line at which debugging execution is paused at, found in the gutter |
| `ui.gutter` | Gutter |
| `ui.gutter.selected` | Gutter for the line the cursor is on |
| `ui.highlight.frameline` | Line at which debugging execution is paused at |
| `ui.linenr` | Line numbers |
| `ui.linenr.selected` | Line number for the line the cursor is on |
| `ui.statusline` | Statusline |
Expand Down Expand Up @@ -306,6 +311,7 @@ These scopes are used for theming the editor interface:
| `ui.menu.scroll` | `fg` sets thumb color, `bg` sets track color of scrollbar |
| `ui.selection` | For selections in the editing area |
| `ui.selection.primary` | |
| `ui.highlight` | Highlighted lines in the picker preview |
| `ui.cursorline.primary` | The line of the primary cursor ([if cursorline is enabled][editor-section]) |
| `ui.cursorline.secondary` | The lines of any other cursors ([if cursorline is enabled][editor-section]) |
| `ui.cursorcolumn.primary` | The column of the primary cursor ([if cursorcolumn is enabled][editor-section]) |
Expand Down
3 changes: 2 additions & 1 deletion helix-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tree-sitter = "0.20"
once_cell = "1.17"
arc-swap = "1"
regex = "1"
bitflags = "1.3"
bitflags = "2.0"
ahash = "0.8.3"
hashbrown = { version = "0.13.2", features = ["raw"] }
dunce = "1.0"
Expand All @@ -50,3 +50,4 @@ textwrap = "0.16.0"

[dev-dependencies]
quickcheck = { version = "1", default-features = false }
indoc = "2.0.1"
49 changes: 3 additions & 46 deletions helix-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,55 +36,12 @@ pub mod unicode {
pub use unicode_width as width;
}

pub use helix_loader::find_workspace;

pub fn find_first_non_whitespace_char(line: RopeSlice) -> Option<usize> {
line.chars().position(|ch| !ch.is_whitespace())
}

/// Find project root.
///
/// Order of detection:
/// * Top-most folder containing a root marker in current git repository
/// * Git repository root if no marker detected
/// * Top-most folder containing a root marker if not git repository detected
/// * Current working directory as fallback
pub fn find_root(root: Option<&str>, root_markers: &[String]) -> std::path::PathBuf {
let current_dir = std::env::current_dir().expect("unable to determine current directory");

let root = match root {
Some(root) => {
let root = std::path::Path::new(root);
if root.is_absolute() {
root.to_path_buf()
} else {
current_dir.join(root)
}
}
None => current_dir.clone(),
};

let mut top_marker = None;
for ancestor in root.ancestors() {
if root_markers
.iter()
.any(|marker| ancestor.join(marker).exists())
{
top_marker = Some(ancestor);
}

if ancestor.join(".git").exists() {
// Top marker is repo root if not root marker was detected yet
if top_marker.is_none() {
top_marker = Some(ancestor);
}
// Don't go higher than repo if we're in one
break;
}
}

// Return the found top marker or the current_dir as fallback
top_marker.map_or(current_dir, |a| a.to_path_buf())
}

pub use ropey::{self, str_utils, Rope, RopeBuilder, RopeSlice};

// pub use tendril::StrTendril as Tendril;
Expand All @@ -98,7 +55,7 @@ pub use {regex, tree_sitter};
pub use graphemes::RopeGraphemes;
pub use position::{
char_idx_at_visual_offset, coords_at_pos, pos_at_coords, visual_offset_from_anchor,
visual_offset_from_block, Position,
visual_offset_from_block, Position, VisualOffsetError,
};
#[allow(deprecated)]
pub use position::{pos_at_visual_coords, visual_coords_at_pos};
Expand Down
14 changes: 7 additions & 7 deletions helix-core/src/movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ mod test {
let text = Rope::from(s.as_str());
let selection =
selection.transform(|r| move_prev_paragraph(text.slice(..), r, 1, Movement::Move));
let actual = crate::test::plain(&s, selection);
let actual = crate::test::plain(s.as_ref(), &selection);
assert_eq!(actual, expected, "\nbefore: `{:?}`", before);
}
}
Expand All @@ -1497,7 +1497,7 @@ mod test {
let text = Rope::from(s.as_str());
let selection =
selection.transform(|r| move_prev_paragraph(text.slice(..), r, 2, Movement::Move));
let actual = crate::test::plain(&s, selection);
let actual = crate::test::plain(s.as_ref(), &selection);
assert_eq!(actual, expected, "\nbefore: `{:?}`", before);
}
}
Expand All @@ -1520,7 +1520,7 @@ mod test {
let text = Rope::from(s.as_str());
let selection = selection
.transform(|r| move_prev_paragraph(text.slice(..), r, 1, Movement::Extend));
let actual = crate::test::plain(&s, selection);
let actual = crate::test::plain(s.as_ref(), &selection);
assert_eq!(actual, expected, "\nbefore: `{:?}`", before);
}
}
Expand All @@ -1540,7 +1540,7 @@ mod test {
"a\nb\n\n#[goto\nthird\n\n|]#paragraph",
),
(
"a\nb#[\n|]#\ngoto\nsecond\n\nparagraph",
"a\nb#[\n|]#\n\ngoto\nsecond\n\nparagraph",
"a\nb#[\n\n|]#goto\nsecond\n\nparagraph",
),
(
Expand All @@ -1562,7 +1562,7 @@ mod test {
let text = Rope::from(s.as_str());
let selection =
selection.transform(|r| move_next_paragraph(text.slice(..), r, 1, Movement::Move));
let actual = crate::test::plain(&s, selection);
let actual = crate::test::plain(s.as_ref(), &selection);
assert_eq!(actual, expected, "\nbefore: `{:?}`", before);
}
}
Expand All @@ -1585,7 +1585,7 @@ mod test {
let text = Rope::from(s.as_str());
let selection =
selection.transform(|r| move_next_paragraph(text.slice(..), r, 2, Movement::Move));
let actual = crate::test::plain(&s, selection);
let actual = crate::test::plain(s.as_ref(), &selection);
assert_eq!(actual, expected, "\nbefore: `{:?}`", before);
}
}
Expand All @@ -1608,7 +1608,7 @@ mod test {
let text = Rope::from(s.as_str());
let selection = selection
.transform(|r| move_next_paragraph(text.slice(..), r, 1, Movement::Extend));
let actual = crate::test::plain(&s, selection);
let actual = crate::test::plain(s.as_ref(), &selection);
assert_eq!(actual, expected, "\nbefore: `{:?}`", before);
}
}
Expand Down
Loading

0 comments on commit 80db69f

Please sign in to comment.