Skip to content

Commit

Permalink
New docs (#1014)
Browse files Browse the repository at this point in the history
* New docs

* fixes

* New docs

* Add custom.css

* fix preview adjustment when layout is UD

* Test load config

* Only run on master push

* fixes

* docs

* Merge vint jobs

* Support vim syntax highlight

ref rust-lang/mdBook#1870 (comment)
  • Loading branch information
liuchengxu authored Nov 1, 2023
1 parent 4cd4c1d commit ebf7c7b
Show file tree
Hide file tree
Showing 35 changed files with 1,154 additions and 471 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: ci
on: [push, pull_request]

jobs:
cpoptions_checker:
name: Check cpoptions
vimscript:
name: VimScript
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -14,16 +14,6 @@ jobs:
uses: actions/checkout@v2
- name: Ensure each vim source file declares cpoptions
run: test/autoload_should_check_cpo.sh

vint:
name: Vint
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run vint with reviewdog
uses: reviewdog/action-vint@v1
with:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Docs

on:
push:
branches: [ master ]

jobs:
build:
name: Build, Test and Deploy
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pull-requests: write # To create a PR from that branch
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: (test -x $HOME/.cargo/bin/mdbook || cargo install --vers "^0.4" mdbook)
- run: mdbook build docs && mdbook test docs
- uses: JamesIves/github-pages-deploy-action@4.1.7
with:
branch: gh-pages
folder: docs/book
24 changes: 18 additions & 6 deletions Cargo.lock

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

354 changes: 2 additions & 352 deletions README.md

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions autoload/clap/floating_win.vim
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ function! clap#floating_win#preview.show(lines) abort

let max_size = s:max_preview_size()
if max_size <= 0
call g:clap#floating_win#preview.close()
call self.close()
return
endif
let lines = a:lines[:max_size]
Expand All @@ -482,8 +482,7 @@ function! clap#floating_win#preview.show(lines) abort
if clap#preview#direction() !=# 'LR'
let opts = nvim_win_get_config(s:preview_winid)
if opts.height != height
let opts.height = height
call nvim_win_set_config(s:preview_winid, opts)
call nvim_win_set_height(s:preview_winid, height)
endif
endif
endif
Expand All @@ -499,7 +498,7 @@ endfunction

function! clap#floating_win#preview.hide() abort
if !clap#preview#is_always_open()
call g:clap#floating_win#preview.close()
call self.close()
endif
endfunction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
" Author: liuchengxu <xuliuchengxlc@gmail.com>
" Highlight the cursor word and the occurrences

let s:save_cpo = &cpoptions
set cpoptions&vim

hi ClapUnderline gui=underline cterm=underline

hi default link ClapCurrentWord IncSearch
hi default link ClapCurrentWordTwins ClapUnderline
hi default link ClapCursorWord IncSearch
hi default link ClapCursorWordTwins ClapUnderline

function! clap#plugin#highlight_cursor_word#add_highlights(word_highlights) abort
function! clap#plugin#cursorword#add_highlights(word_highlights) abort
let cword_len = a:word_highlights.cword_len
let match_ids = []
let [lnum, col] = a:word_highlights.cword_highlight
let match_id = matchaddpos('ClapCurrentWord', [[lnum, col+1, cword_len]])
let match_id = matchaddpos('ClapCursorWord', [[lnum, col+1, cword_len]])
if match_id > -1
call add(match_ids, match_id)
endif
for [lnum, col] in a:word_highlights.other_words_highlight
let match_id = matchaddpos('ClapCurrentWordTwins', [[lnum, col+1, cword_len]])
for [lnum, col] in a:word_highlights.twins_words_highlight
let match_id = matchaddpos('ClapCursorWordTwins', [[lnum, col+1, cword_len]])
if match_id > -1
call add(match_ids, match_id)
endif
Expand Down
2 changes: 1 addition & 1 deletion autoload/clap/plugin/linter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function! s:render_on_top_right(lines, line_highlights) abort
" Make sure the diagnostic win won't interfere with the existing code
" display.
let max_available_on_top = s:max_available_length_on_top()
if width > max_available_on_top
if max_available_on_top > 0 && width > max_available_on_top
let width = max_available_on_top
let height += 1
endif
Expand Down
1 change: 0 additions & 1 deletion autoload/clap/state.vim
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ function! clap#state#render_preview(preview) abort
endif

if has_key(a:preview, 'scrollbar')
let g:scrollbar = copy(a:preview.scrollbar)
let [top_position, length] = a:preview.scrollbar
call clap#floating_win#show_preview_scrollbar(top_position, length)
endif
Expand Down
1 change: 1 addition & 0 deletions crates/linter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ pub fn find_workspace(filetype: impl AsRef<str>, source_file: &Path) -> Option<&
("rust", RootMarkers(&["Cargo.toml"])),
("sh", ParentOfSourceFile),
("vim", ParentOfSourceFile),
("markdown", ParentOfSourceFile),
])
});

Expand Down
2 changes: 1 addition & 1 deletion crates/linter/src/linters/go.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::Path;
// /home/xlc/Data0/src/github.com/ethereum-optimism/optimism/op-node/rollup/superchain.go:38:27-43: undefined: eth.XXXXSystemConfig
static RE: Lazy<Regex> = Lazy::new(|| {
Regex::new(r"(?m)^([^:]+):([0-9]+):([0-9]+)-([0-9]+): (.+)$")
.expect("Regex for parsing gopls output must be correct otherwise the format is changed")
.expect("Regex for parsing gopls output must be correct otherwise the upstream format must have been changed")
});

pub async fn run_gopls(source_file: &Path, workspace_root: &Path) -> std::io::Result<LinterResult> {
Expand Down
Loading

0 comments on commit ebf7c7b

Please sign in to comment.