Skip to content

Commit

Permalink
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cessen committed Jul 17, 2021
2 parents b4c59b4 + 6cba62b commit a77274e
Show file tree
Hide file tree
Showing 25 changed files with 1,177 additions and 783 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
else
cp "target/${{ matrix.target }}/release/hx" "dist/"
fi
cp -r runtime dist
- uses: actions/[email protected]
with:
Expand Down Expand Up @@ -148,7 +149,7 @@ jobs:
pkgname=helix-$TAG-$platform
mkdir tmp/$pkgname
cp LICENSE README.md tmp/$pkgname
cp -r runtime tmp/$pkgname/
mv bins-$platform/runtime tmp/$pkgname/
mv bins-$platform/hx$exe tmp/$pkgname
chmod +x tmp/$pkgname/hx$exe
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ target
helix-term/rustfmt.toml
helix-syntax/languages/
result
runtime/grammars
57 changes: 28 additions & 29 deletions Cargo.lock

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

11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ cargo install --path helix-term

This will install the `hx` binary to `$HOME/.cargo/bin`.

Now copy the `runtime/` directory somewhere. Helix will by default look for the runtime
inside the config directory or the same directory as executable, but that can be overriden
Helix also needs it's runtime files so make sure to copy/symlink the `runtime/` directory into the
config directory (for example `~/.config/helix/runtime` on Linux/macOS). This location can be overriden
via the `HELIX_RUNTIME` environment variable.

> NOTE: running via cargo doesn't require setting explicit `HELIX_RUNTIME` path, it will automatically
Packages already solve this for you by wrapping the `hx` binary with a wrapper
that sets the variable to the install dir.

> NOTE: running via cargo also doesn't require setting explicit `HELIX_RUNTIME` path, it will automatically
> detect the `runtime` directory in the project root.
If you want to embed the `runtime/` directory into the Helix binary you can build
Alternatively, if you want to embed the `runtime/` directory into the Helix binary you can build
it with:

```
Expand Down
43 changes: 23 additions & 20 deletions book/src/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,29 @@

### Changes

| Key | Description |
| ----- | ----------- |
| `r` | Replace with a character |
| `R` | Replace with yanked text |
| `i` | Insert before selection |
| `a` | Insert after selection (append) |
| `I` | Insert at the start of the line |
| `A` | Insert at the end of the line |
| `o` | Open new line below selection |
| `o` | Open new line above selection |
| `u` | Undo change |
| `U` | Redo change |
| `y` | Yank selection |
| `p` | Paste after selection |
| `P` | Paste before selection |
| `>` | Indent selection |
| `<` | Unindent selection |
| `=` | Format selection |
| `d` | Delete selection |
| `c` | Change selection (delete and enter insert mode) |
| Key | Description |
| ----- | ----------- |
| `r` | Replace with a character |
| `R` | Replace with yanked text |
| `~` | Switch case of the selected text |
| `\`` | Set the selected text to upper case |
| `Alt-\`` | Set the selected text to lower case |
| `i` | Insert before selection |
| `a` | Insert after selection (append) |
| `I` | Insert at the start of the line |
| `A` | Insert at the end of the line |
| `o` | Open new line below selection |
| `o` | Open new line above selection |
| `u` | Undo change |
| `U` | Redo change |
| `y` | Yank selection |
| `p` | Paste after selection |
| `P` | Paste before selection |
| `>` | Indent selection |
| `<` | Unindent selection |
| `=` | Format selection |
| `d` | Delete selection |
| `c` | Change selection (delete and enter insert mode) |

### Selection manipulation

Expand Down
2 changes: 2 additions & 0 deletions book/src/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Possible keys:
| `attribute` | |
| `keyword` | |
| `keyword.directive` | Preprocessor directives (\#if in C) |
| `keyword.control` | Control flow |
| `namespace` | |
| `punctuation` | |
| `punctuation.delimiter` | |
Expand All @@ -61,6 +62,7 @@ Possible keys:
| `variable.parameter` | |
| `type` | |
| `type.builtin` | |
| `type.enum.variant` | Enum variants |
| `constructor` | |
| `function` | |
| `function.macro` | |
Expand Down
2 changes: 1 addition & 1 deletion helix-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ helix-syntax = { version = "0.3", path = "../helix-syntax" }
ropey = "1.3"
smallvec = "1.4"
tendril = "0.4.2"
unicode-segmentation = "1.7"
unicode-segmentation = "1.8"
unicode-width = "0.1"
unicode-general-category = "0.4"
# slab = "0.4.2"
Expand Down
4 changes: 2 additions & 2 deletions helix-core/src/indent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ where

let doc = Rope::from(doc);
use crate::syntax::{
Configuration, IndentationConfiguration, Lang, LanguageConfiguration, Loader,
Configuration, IndentationConfiguration, LanguageConfiguration, Loader,
};
use once_cell::sync::OnceCell;
let loader = Loader::new(Configuration {
language: vec![LanguageConfiguration {
scope: "source.rust".to_string(),
file_types: vec!["rs".to_string()],
language_id: Lang::Rust,
language_id: "Rust".to_string(),
highlight_config: OnceCell::new(),
//
roots: vec![],
Expand Down
16 changes: 8 additions & 8 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
Rope, RopeSlice, Tendril,
};

pub use helix_syntax::{get_language, get_language_name, Lang};
pub use helix_syntax::get_language;

use arc_swap::ArcSwap;

Expand All @@ -31,7 +31,7 @@ pub struct Configuration {
#[serde(rename_all = "kebab-case")]
pub struct LanguageConfiguration {
#[serde(rename = "name")]
pub(crate) language_id: Lang,
pub(crate) language_id: String,
pub scope: String, // source.rust
pub file_types: Vec<String>, // filename ends_with? <Gemfile, rb, etc>
pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml>
Expand Down Expand Up @@ -153,25 +153,25 @@ fn read_query(language: &str, filename: &str) -> String {

impl LanguageConfiguration {
fn initialize_highlight(&self, scopes: &[String]) -> Option<Arc<HighlightConfiguration>> {
let language = get_language_name(self.language_id).to_ascii_lowercase();
let language = self.language_id.to_ascii_lowercase();

let highlights_query = read_query(&language, "highlights.scm");
// always highlight syntax errors
// highlights_query += "\n(ERROR) @error";

let injections_query = read_query(&language, "injections.scm");

let locals_query = "";
let locals_query = read_query(&language, "locals.scm");

if highlights_query.is_empty() {
None
} else {
let language = get_language(self.language_id);
let language = get_language(&crate::RUNTIME_DIR, &self.language_id).ok()?;
let config = HighlightConfiguration::new(
language,
&highlights_query,
&injections_query,
locals_query,
&locals_query,
)
.unwrap(); // TODO: no unwrap
config.configure(scopes);
Expand All @@ -198,7 +198,7 @@ impl LanguageConfiguration {
pub fn indent_query(&self) -> Option<&IndentQuery> {
self.indent_query
.get_or_init(|| {
let language = get_language_name(self.language_id).to_ascii_lowercase();
let language = self.language_id.to_ascii_lowercase();

let toml = load_runtime_file(&language, "indents.toml").ok()?;
toml::from_slice(toml.as_bytes()).ok()
Expand Down Expand Up @@ -1812,7 +1812,7 @@ mod test {
.map(String::from)
.collect();

let language = get_language(Lang::Rust);
let language = get_language(&crate::RUNTIME_DIR, "Rust").unwrap();
let config = HighlightConfiguration::new(
language,
&std::fs::read_to_string(
Expand Down
4 changes: 2 additions & 2 deletions helix-lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ lsp-types = { version = "0.89", features = ["proposed"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
tokio = { version = "1.7", features = ["full"] }
tokio-stream = "0.1.6"
tokio = { version = "1.8", features = ["full"] }
tokio-stream = "0.1.7"
6 changes: 4 additions & 2 deletions helix-syntax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ include = ["src/**/*", "languages/**/*", "build.rs", "!**/docs/**/*", "!**/test/

[dependencies]
tree-sitter = "0.19"
serde = { version = "1.0", features = ["derive"] }
libloading = "0.7"
anyhow = "1"

[build-dependencies]
cc = { version = "1", features = ["parallel"] }
cc = { version = "1" }
threadpool = { version = "1.0" }
anyhow = "1"
Loading

0 comments on commit a77274e

Please sign in to comment.