Improve Readability (#2639)

pull/2643/head
Ryan Russell 2 years ago committed by GitHub
parent fc666db6b9
commit ae12c58f0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,4 +9,4 @@ single width selection.
See also Kakoune's [Migrating from Vim](https://github.com/mawww/kakoune/wiki/Migrating-from-Vim). See also Kakoune's [Migrating from Vim](https://github.com/mawww/kakoune/wiki/Migrating-from-Vim).
> TODO: Mention texobjects, surround, registers > TODO: Mention textobjects, surround, registers

@ -14,7 +14,7 @@ pub fn grapheme_width(g: &str) -> usize {
// Point 1: theoretically, ascii control characters should have zero // Point 1: theoretically, ascii control characters should have zero
// width, but in our case we actually want them to have width: if they // width, but in our case we actually want them to have width: if they
// show up in text, we want to treat them as textual elements that can // show up in text, we want to treat them as textual elements that can
// be editied. So we can get away with making all ascii single width // be edited. So we can get away with making all ascii single width
// here. // here.
// Point 2: we're only examining the first codepoint here, which means // Point 2: we're only examining the first codepoint here, which means
// we're ignoring graphemes formed with combining characters. However, // we're ignoring graphemes formed with combining characters. However,

@ -177,7 +177,7 @@ impl History {
} }
} }
/// List of nodes on the way from `n` to 'a`. Doesn`t include `a`. /// List of nodes on the way from `n` to 'a`. Doesn't include `a`.
/// Includes `n` unless `a == n`. `a` must be an ancestor of `n`. /// Includes `n` unless `a == n`. `a` must be an ancestor of `n`.
fn path_up(&self, mut n: usize, a: usize) -> Vec<usize> { fn path_up(&self, mut n: usize, a: usize) -> Vec<usize> {
let mut path = Vec::new(); let mut path = Vec::new();
@ -546,8 +546,8 @@ mod test {
// Units are validated. // Units are validated.
assert_eq!( assert_eq!(
"1 millenium".parse::<UndoKind>(), "1 millennium".parse::<UndoKind>(),
Err("incorrect time unit: millenium".to_string()) Err("incorrect time unit: millennium".to_string())
); );
// Units can't be specified twice. // Units can't be specified twice.

@ -377,7 +377,7 @@ mod test {
} }
#[test] #[test]
fn test_increment_basic_hexadedimal_numbers() { fn test_increment_basic_hexadecimal_numbers() {
let tests = [ let tests = [
("0x0100", 1, "0x0101"), ("0x0100", 1, "0x0101"),
("0x0100", -1, "0x00ff"), ("0x0100", -1, "0x00ff"),

@ -43,7 +43,7 @@ pub fn find_first_non_whitespace_char(line: RopeSlice) -> Option<usize> {
/// ///
/// Order of detection: /// Order of detection:
/// * Top-most folder containing a root marker in current git repository /// * Top-most folder containing a root marker in current git repository
/// * Git repostory root if no marker detected /// * Git repository root if no marker detected
/// * Top-most folder containing a root marker if not git repository detected /// * Top-most folder containing a root marker if not git repository detected
/// * Current working directory as fallback /// * Current working directory as fallback
pub fn find_root(root: Option<&str>, root_markers: &[String]) -> Option<std::path::PathBuf> { pub fn find_root(root: Option<&str>, root_markers: &[String]) -> Option<std::path::PathBuf> {

@ -830,7 +830,7 @@ mod test {
} }
#[test] #[test]
fn test_graphem_aligned() { fn test_grapheme_aligned() {
let r = Rope::from_str("\r\nHi\r\n"); let r = Rope::from_str("\r\nHi\r\n");
let s = r.slice(..); let s = r.slice(..);

@ -66,7 +66,7 @@ pub fn find_nth_closest_pairs_pos(
for ch in text.chars_at(pos) { for ch in text.chars_at(pos) {
if is_open_pair(ch) { if is_open_pair(ch) {
// Track open pairs encountered so that we can step over // Track open pairs encountered so that we can step over
// the correspoding close pairs that will come up further // the corresponding close pairs that will come up further
// down the loop. We want to find a lone close pair whose // down the loop. We want to find a lone close pair whose
// open pair is before the cursor position. // open pair is before the cursor position.
stack.push(ch); stack.push(ch);

@ -1964,7 +1964,7 @@ fn shrink_to_line_bounds(cx: &mut Context) {
// line_to_char gives us the start position of the line, so // line_to_char gives us the start position of the line, so
// we need to get the start position of the next line. In // we need to get the start position of the next line. In
// the editor, this will correspond to the cursor being on // the editor, this will correspond to the cursor being on
// the EOL whitespace charactor, which is what we want. // the EOL whitespace character, which is what we want.
let mut end = text.line_to_char((end_line + 1).min(text.len_lines())); let mut end = text.line_to_char((end_line + 1).min(text.len_lines()));
if start != range.from() { if start != range.from() {
@ -2929,7 +2929,7 @@ pub mod insert {
Transaction::change_by_selection(doc.text(), doc.selection(view.id), |range| { Transaction::change_by_selection(doc.text(), doc.selection(view.id), |range| {
let pos = range.cursor(text); let pos = range.cursor(text);
let line_start_pos = text.line_to_char(range.cursor_line(text)); let line_start_pos = text.line_to_char(range.cursor_line(text));
// considier to delete by indent level if all characters before `pos` are indent units. // consider to delete by indent level if all characters before `pos` are indent units.
let fragment = Cow::from(text.slice(line_start_pos..pos)); let fragment = Cow::from(text.slice(line_start_pos..pos));
if !fragment.is_empty() && fragment.chars().all(|ch| ch.is_whitespace()) { if !fragment.is_empty() && fragment.chars().all(|ch| ch.is_whitespace()) {
if text.get_char(pos.saturating_sub(1)) == Some('\t') { if text.get_char(pos.saturating_sub(1)) == Some('\t') {

@ -416,8 +416,8 @@ pub fn apply_workspace_edit(
} }
lsp::DocumentChanges::Operations(operations) => { lsp::DocumentChanges::Operations(operations) => {
log::debug!("document changes - operations: {:?}", operations); log::debug!("document changes - operations: {:?}", operations);
for operateion in operations { for operation in operations {
match operateion { match operation {
lsp::DocumentChangeOperation::Op(op) => { lsp::DocumentChangeOperation::Op(op) => {
apply_document_resource_op(op).unwrap(); apply_document_resource_op(op).unwrap();
} }

@ -542,7 +542,7 @@ mod tests {
vec![vec![key!('j')], vec![key!('k')]] vec![vec![key!('j')], vec![key!('k')]]
), ),
]), ]),
"Mistmatch" "Mismatch"
) )
} }
} }

@ -86,7 +86,7 @@ pub fn breakpoints_changed(
path: PathBuf, path: PathBuf,
breakpoints: &mut [Breakpoint], breakpoints: &mut [Breakpoint],
) -> Result<(), anyhow::Error> { ) -> Result<(), anyhow::Error> {
// TODO: handle capabilities correctly again, by filterin breakpoints when emitting // TODO: handle capabilities correctly again, by filtering breakpoints when emitting
// if breakpoint.condition.is_some() // if breakpoint.condition.is_some()
// && !debugger // && !debugger
// .caps // .caps

Loading…
Cancel
Save