-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Catacomba/telescope-file-…
- Loading branch information
Showing
13 changed files
with
257 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Tests | ||
on: [push] | ||
jobs: | ||
test: | ||
name: unit tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
version: [v0.9.0, nightly] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: date +%F > todays-date | ||
|
||
- uses: rhysd/action-setup-vim@v1 | ||
with: | ||
neovim: true | ||
version: ${{ matrix.version }} | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-deps-${{ matrix.version }}-${{ hashFiles('todays-date') }} | ||
restore-keys: | | ||
${{ runner.os }}-deps-${{ matrix.version }}- | ||
- name: Run tests | ||
run: | | ||
nvim --version | ||
make test | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
doc/tags | ||
deps/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
docgen: | ||
.PHONY: docgen test clean | ||
|
||
DEPS_DIR := deps | ||
TS_DIR := $(DEPS_DIR)/tree-sitter-lua | ||
PLENARY_DIR := $(DEPS_DIR)/plenary.nvim | ||
TELESCOPE_DIR := $(DEPS_DIR)/telescope.nvim | ||
|
||
define git_clone_or_pull | ||
@mkdir -p $(dir $1) | ||
@if [ ! -d "$1" ]; then \ | ||
git clone --depth 1 $2 $1; \ | ||
else \ | ||
git -C "$1" pull; \ | ||
fi | ||
endef | ||
|
||
$(DEPS_DIR): | ||
@mkdir -p $@ | ||
|
||
plenary: | $(DEPS_DIR) | ||
$(call git_clone_or_pull,$(PLENARY_DIR),https://github.com/nvim-lua/plenary.nvim) | ||
|
||
docgen-deps: plenary | $(DEPS_DIR) | ||
$(call git_clone_or_pull,$(TS_DIR),https://github.com/tjdevries/tree-sitter-lua) | ||
cd "$(TS_DIR)" && make dist | ||
|
||
test-deps: plenary | $(DEPS_DIR) | ||
$(call git_clone_or_pull,$(TELESCOPE_DIR),https://github.com/nvim-telescope/telescope.nvim) | ||
|
||
docgen: docgen-deps | ||
nvim --headless --noplugin -u scripts/minimal_init.vim -c "luafile ./scripts/gendocs.lua" -c 'qa' | ||
|
||
test: test-deps | ||
nvim --headless --noplugin -u scripts/minimal_init.vim -c "PlenaryBustedDirectory lua/tests/ { minimal_init = './scripts/minimal_init.vim' }" | ||
|
||
clean: | ||
@rm -rf $(DEPS_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
lua/telescope/_extensions/file_browser/make_entry_utils.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local Path = require "plenary.path" | ||
local fb_utils = require "telescope._extensions.file_browser.utils" | ||
|
||
local os_sep = Path.path.sep | ||
local os_sep_len = #os_sep | ||
|
||
local M = {} | ||
|
||
--- compute ordinal path | ||
--- accounts for `auto_depth` option | ||
---@param path string | ||
---@param cwd string | ||
---@param parent string | ||
---@return string | ||
M.get_ordinal_path = function(path, cwd, parent) | ||
path = fb_utils.sanitize_path_str(path) | ||
if path == cwd then | ||
return "." | ||
elseif path == parent then | ||
return ".." | ||
end | ||
|
||
local cwd_substr = #cwd + 1 | ||
cwd_substr = cwd:sub(-1, -1) ~= os_sep and cwd_substr + os_sep_len or cwd_substr | ||
|
||
return path:sub(cwd_substr, -1) | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.