mirror of
https://github.com/hrsh7th/nvim-cmp
synced 2024-09-16 20:54:03 +02:00
fix CI (#1462)
This commit is contained in:
parent
7a3b1e76f7
commit
339186c979
6 changed files with 29 additions and 97 deletions
25
.github/workflows/format.yaml
vendored
Normal file
25
.github/workflows/format.yaml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
name: format
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '**.lua'
|
||||
|
||||
jobs:
|
||||
postprocessing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Format with Stylua
|
||||
uses: JohnnyMorganz/stylua-action@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: v0.16.1
|
||||
args: ./lua
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "Format with stylua"
|
10
.github/workflows/integration.yaml
vendored
10
.github/workflows/integration.yaml
vendored
|
@ -16,13 +16,6 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
default: true
|
||||
override: true
|
||||
|
||||
- name: Setup neovim
|
||||
uses: rhysd/action-setup-vim@v1
|
||||
with:
|
||||
|
@ -40,12 +33,9 @@ jobs:
|
|||
- name: Setup tools
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt install -y curl unzip --no-install-recommends
|
||||
bash ./utils/install_stylua.sh
|
||||
luarocks install luacheck
|
||||
luarocks install vusted
|
||||
|
||||
- name: Run tests
|
||||
shell: bash
|
||||
run: make integration
|
||||
|
||||
|
|
17
Makefile
17
Makefile
|
@ -1,13 +1,3 @@
|
|||
.PHONY: install-stylua
|
||||
install-stylua:
|
||||
@if [ ! -f "./utils/stylua" ]; then \
|
||||
sh ./utils/install_stylua.sh; \
|
||||
fi
|
||||
|
||||
.PHONY: fmt
|
||||
fmt: install-stylua
|
||||
./utils/stylua --config-path stylua.toml --glob 'lua/**/*.lua' -- lua
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
luacheck ./lua
|
||||
|
@ -17,14 +7,11 @@ test:
|
|||
vusted --output=gtest ./lua
|
||||
|
||||
.PHONY: pre-commit
|
||||
pre-commit: install-stylua
|
||||
./utils/stylua --config-path stylua.toml --glob 'lua/**/*.lua' -- lua
|
||||
pre-commit:
|
||||
luacheck lua
|
||||
vusted lua
|
||||
|
||||
.PHONY: integration
|
||||
integration: install-stylua
|
||||
./utils/stylua --config-path stylua.toml --check --glob 'lua/**/*.lua' -- lua
|
||||
integration:
|
||||
luacheck lua
|
||||
vusted lua
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
local types = require('cmp.types')
|
||||
local cache = require('cmp.utils.cache')
|
||||
local misc = require('cmp.utils.misc')
|
||||
|
||||
local compare = {}
|
||||
|
||||
|
|
|
@ -361,14 +361,7 @@ end
|
|||
---@param matching_config cmp.MatchingConfig
|
||||
---@return { score: integer, matches: table[] }
|
||||
entry.match = function(self, input, matching_config)
|
||||
return self.match_cache:ensure(
|
||||
input .. ':' ..
|
||||
(self.resolved_completion_item and '1' or '0' .. ':') ..
|
||||
(matching_config.disallow_fuzzy_matching and '1' or '0') .. ':' ..
|
||||
(matching_config.disallow_partial_fuzzy_matching and '1' or '0') .. ':' ..
|
||||
(matching_config.disallow_partial_matching and '1' or '0') .. ':' ..
|
||||
(matching_config.disallow_prefix_unmatching and '1' or '0')
|
||||
, function()
|
||||
return self.match_cache:ensure(input .. ':' .. (self.resolved_completion_item and '1' or '0' .. ':') .. (matching_config.disallow_fuzzy_matching and '1' or '0') .. ':' .. (matching_config.disallow_partial_fuzzy_matching and '1' or '0') .. ':' .. (matching_config.disallow_partial_matching and '1' or '0') .. ':' .. (matching_config.disallow_prefix_unmatching and '1' or '0'), function()
|
||||
local option = {
|
||||
disallow_fuzzy_matching = matching_config.disallow_fuzzy_matching,
|
||||
disallow_partial_fuzzy_matching = matching_config.disallow_partial_fuzzy_matching,
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eu pipefall
|
||||
|
||||
declare -r INSTALL_DIR="$PWD/utils"
|
||||
declare -r RELEASE="0.10.0"
|
||||
declare -r OS=$([ "$(uname -s)" == "Darwin" ] && echo "macos" || echo "linux")
|
||||
declare -r FILENAME="stylua-$RELEASE-$OS"
|
||||
|
||||
declare -a __deps=("curl" "unzip")
|
||||
|
||||
function check_deps() {
|
||||
for dep in "${__deps[@]}"; do
|
||||
if ! command -v "$dep" >/dev/null; then
|
||||
echo "Missing depdendecy!"
|
||||
echo "The \"$dep\" command was not found!. Please install and try again."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function download_stylua() {
|
||||
local DOWNLOAD_DIR
|
||||
local URL="https://github.com/JohnnyMorganz/StyLua/releases/download/v$RELEASE/$FILENAME.zip"
|
||||
|
||||
DOWNLOAD_DIR="$(mktemp -d)"
|
||||
echo "Initiating download for Stylua v$RELEASE"
|
||||
if ! curl --progress-bar --fail -L "$URL" -o "$DOWNLOAD_DIR/$FILENAME.zip"; then
|
||||
echo "Download failed. Check that the release/filename are correct."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Installation in progress.."
|
||||
unzip -q "$DOWNLOAD_DIR/$FILENAME.zip" -d "$DOWNLOAD_DIR"
|
||||
|
||||
if [ -f "$DOWNLOAD_DIR/stylua" ]; then
|
||||
mv "$DOWNLOAD_DIR/stylua" "$INSTALL_DIR/stylua"
|
||||
else
|
||||
mv "$DOWNLOAD_DIR/$FILENAME/stylua" "$INSTALL_DIR/."
|
||||
fi
|
||||
|
||||
chmod u+x "$INSTALL_DIR/stylua"
|
||||
}
|
||||
|
||||
function verify_install() {
|
||||
echo "Verifying installation.."
|
||||
local DOWNLOADED_VER
|
||||
DOWNLOADED_VER="$("$INSTALL_DIR/stylua" -V | awk '{ print $2 }')"
|
||||
if [ "$DOWNLOADED_VER" != "$RELEASE" ]; then
|
||||
echo "Mismatched version!"
|
||||
echo "Expected: v$RELEASE but got v$DOWNLOADED_VER"
|
||||
exit 1
|
||||
fi
|
||||
echo "Verification complete!"
|
||||
}
|
||||
|
||||
function main() {
|
||||
check_deps
|
||||
download_stylua
|
||||
verify_install
|
||||
}
|
||||
|
||||
main "$@"
|
Loading…
Reference in a new issue