Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine tree-sitter highlight configs #1022

Merged
merged 28 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
72e62ef
Refine tree-sitter vim
liuchengxu Nov 20, 2023
82741cc
tree-sitter: detect language from filetype properly
liuchengxu Nov 20, 2023
a4b085d
Update release.sh
liuchengxu Nov 20, 2023
ab56dbf
Add linter/{first, last}-{error,warn}
liuchengxu Nov 20, 2023
a5892bb
Add dedicated c and go highlight names module
liuchengxu Nov 20, 2023
1559872
Reorder some codes
liuchengxu Nov 20, 2023
92a6bf7
Add preview highlights for files provider
liuchengxu Nov 20, 2023
0fab4aa
Extract line_count(path) in utils
liuchengxu Nov 20, 2023
751c9c2
Refactor context_tag impl
liuchengxu Nov 20, 2023
99ea631
Extract file_size() in utils
liuchengxu Nov 20, 2023
e10085e
Add a utility file size checker
liuchengxu Nov 21, 2023
6f36a3b
Fix Config deserialize
liuchengxu Nov 21, 2023
fda7119
Parse struct and field docs
liuchengxu Nov 23, 2023
1ac5f31
WIP
liuchengxu Nov 23, 2023
9b7d030
Write lines to /tmp/config.toml
liuchengxu Nov 23, 2023
4bd17a2
Refine some docs in config.rs
liuchengxu Nov 24, 2023
f7318d2
Add tree_sitter_config.toml
liuchengxu Nov 25, 2023
ba47e80
Add language.javascript
liuchengxu Nov 25, 2023
bf728e7
Nits
liuchengxu Nov 25, 2023
a0c3a22
Fix tests
liuchengxu Nov 25, 2023
1d6bcea
Update some docs
liuchengxu Nov 25, 2023
5b311d3
Adjust popup position for quick_pick mode
liuchengxu Nov 25, 2023
f04a918
Only try re-adjust the position with quick_pick mode
liuchengxu Nov 25, 2023
06256e2
Extract calculate_scrollbar()
liuchengxu Nov 26, 2023
af3970f
Extract display_diagnostics_at_cursor()
liuchengxu Nov 26, 2023
1b9523f
clippy fixes
liuchengxu Nov 26, 2023
6c782a7
Add start_pos() to DiagnosticSpan and fix the diagnostic navigation
liuchengxu Nov 26, 2023
7a26c00
Extract format_buffer()
liuchengxu Nov 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

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

30 changes: 21 additions & 9 deletions autoload/clap/layout.vim
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,15 @@ if s:is_nvim
let opts = {'relative': 'win', 'win': g:clap.start.winid}
call s:adjust_indicator_width()
endif
return extend(opts, {
\ 'width': s:calc(width, layout.width),
\ 'height': s:calc(height, layout.height),
\ 'row': s:calc(height, layout.row),
\ 'col': s:calc(width, layout.col),
\ })
let width = s:calc(width, layout.width)
let height = s:calc(height, layout.height)
let row = s:calc(height, layout.row)
let col = s:calc(width, layout.col)
if opts.relative ==# 'editor' && g:clap.provider.mode() ==# 'quick_pick'
let adjustment = (&columns - col - width) / 2
let col += adjustment
endif
return extend(opts, { 'width': width, 'height': height, 'row': row, 'col': col })
endfunction

function! s:calc_default() abort
Expand All @@ -149,7 +152,8 @@ if s:is_nvim
else
function! s:user_layout() abort
let layout = s:layout()
if has_key(layout, 'relative') && layout.relative ==# 'editor'
let relative_to_editor = has_key(layout, 'relative') && layout.relative ==# 'editor'
if relative_to_editor
let [row, col] = [0, 0]
let width = &columns
let height = &lines
Expand All @@ -159,11 +163,19 @@ else
let height = winheight(g:clap.start.winid)
call s:adjust_indicator_width()
endif
let width = s:calc(width, layout.width)
let col = s:calc(width, layout.col) + col

if relative_to_editor && g:clap.provider.mode() ==# 'quick_pick'
let adjustment = (&columns - col - width) / 2
let col += adjustment
endif

return {
\ 'width': s:calc(width, layout.width),
\ 'width': width,
\ 'height': s:calc(height, layout.height),
\ 'row': s:calc(height, layout.row) + row,
\ 'col': s:calc(width, layout.col) + col,
\ 'col': col
\ }
endfunction

Expand Down
2 changes: 2 additions & 0 deletions crates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ members = [
"upgrade",
]

exclude = ["config_gen"]

[workspace.dependencies]
anyhow = "1.0"
async-trait = "0.1"
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rayon::prelude::*;
use std::io::BufRead;
use std::sync::Arc;
use types::ClapItem;
use utils::count_lines;
use utils::line_count;

fn prepare_source_items() -> Vec<SourceItem> {
let largest_cache = find_largest_cache_digest().expect("Cache is empty");
Expand Down Expand Up @@ -145,7 +145,7 @@ fn bench_regex_searcher(c: &mut Criterion) {
fn bench_bytecount(c: &mut Criterion) {
let largest_cache = find_largest_cache_digest().expect("Cache is empty");
c.bench_function("bytecount", |b| {
b.iter(|| count_lines(std::fs::File::open(&largest_cache.cached_path).unwrap()))
b.iter(|| line_count(&largest_cache.cached_path).unwrap())
});
}

Expand Down
Loading
Loading