chore: add pre-commit workflow (#72)

* chore: add pre-commit workflow

* fix pre-commit
add-more-languages
Meng Zhang 2023-04-09 20:17:56 +08:00 committed by GitHub
parent 9915c57e02
commit e28877fbbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 8 deletions

14
.github/workflows/pre-commit.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: pre-commit
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0

View File

@ -4,7 +4,7 @@
1. VIM 9.0+ with `+job` and `+textprop` features enabled. NeoVIM is not supported at the moment.
2. Node.js 16.0+, with `yarn` or `npm` installed.
## Setup
1. Build node scripts in `node_scripts/` directory. Use `yarn` as example. You can also use `npm` instead.
@ -34,4 +34,3 @@
1. In insert mode, Tabby will show code suggestion when you stop typing. Press `<Tab>` to accpet the current suggestion, `<M-]>` to see the next suggestion, `<M-[>` to see previous suggestion, or `<C-]>` to dismiss.
2. Use command `:Tabby enable` to enable, `:Tabby disable` to disable Tabby, and `:Tabby status` to check status.

View File

@ -301,7 +301,7 @@ function! tabby#Accept(fallback)
return a:fallback
endif
let lines = s:prop_shown_lines
if len(lines) == 1
if len(lines) == 1
let s:text_to_insert = lines[0]
let insertion = "\<C-R>\<C-O>=tabby#ComsumeInsertion()\<CR>"
else
@ -331,7 +331,7 @@ function! tabby#Next()
if s:completion_index == len(s:completion.choices)
let s:completion_index = 0
endif
else
else
let s:completion_index += 1
if s:completion_index > len(s:completion.choices)
let s:completion_index = 0
@ -348,7 +348,7 @@ function! tabby#Prev()
if s:completion_index == len(s:completion.choices)
let s:completion_index = len(s:completion.choices) - 1
endif
else
else
let s:completion_index -= 1
if s:completion_index < 0
let s:completion_index = len(s:completion.choices)

View File

@ -25,4 +25,4 @@ module.exports = {
}
]
},
};
};

View File

@ -25,4 +25,3 @@ augroup tabby
autocmd BufLeave * call tabby#Clear()
autocmd InsertLeave * call tabby#Clear()
augroup END

View File

@ -77,4 +77,3 @@ function toDisabled() {
item.tooltip = "Tabby is disabled. Click to enable.";
item.command = "tabby.toggleEnabled";
}

View File

@ -8,6 +8,7 @@ class Choice(BaseModel):
index: int
text: str
# https://code.visualstudio.com/docs/languages/identifiers
class Language(str, Enum):
UNKNOWN = "unknown"