Skip to content

Commit

Permalink
refactor: remove teal
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Jun 13, 2023
1 parent 4455bb5 commit 4d63d99
Show file tree
Hide file tree
Showing 84 changed files with 4,928 additions and 13,781 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: true
matrix:
neovim_branch: ['v0.8.3', 'nightly']
neovim_branch: ['v0.8.3', 'v0.9.1', 'nightly']
runs-on: ubuntu-latest
env:
NEOVIM_BRANCH: ${{ matrix.neovim_branch }}
Expand Down Expand Up @@ -56,11 +56,5 @@ jobs:
if: steps.cache-deps.outputs.cache-hit != 'true'
run: make test_deps

- name: Install Lua Deps
run: make lua_deps

- name: Check lua files are built from latest teal
run: make tl-ensure

- name: Run Test
run: make test
6 changes: 6 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"
53 changes: 1 addition & 52 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,9 @@
- [Luarocks](https://luarocks.org/)
- `brew install luarocks`

## Writing Teal

**Do not edit files in the lua dir**.

Gitsigns is implemented in teal which is essentially lua+types.
The teal source files are generated into lua files and must be checked in together when making changes.
CI will enforce this.

Once you have made changes in teal, the corresponding lua files can be built with:

```
make tl-build
```

## Generating docs

Most of the documentation is handwritten however the documentation for the configuration is generated from `teal/gitsigns/config.tl` which contains the configuration schema.
Most of the documentation is handwritten however the documentation for the configuration is generated from `lua/gitsigns/config.lua` which contains the configuration schema.
The documentation is generated with the lua script `gen_help.lua` which has been developed just enough to handle the current configuration schema so from time to time this script might need small improvements to handle new features but for the most part it works.

The documentation can be updated with:
Expand All @@ -46,40 +32,3 @@ To run the testsuite:
```
make test
```

## [Diagnostic-ls](https://github.com/iamcco/diagnostic-languageserver) config for teal

```
require('lspconfig').diagnosticls.setup{
filetypes = {'teal'},
init_options = {
filetypes = {teal = {'tealcheck'}},
linters = {
tealcheck = {
sourceName = "tealcheck",
command = "tl",
args = {'check', '%file'},
isStdout = false, isStderr = true,
rootPatterns = {"tlconfig.lua", ".git"},
formatPattern = {
'^([^:]+):(\\d+):(\\d+): (.+)$', {
sourceName = 1, sourceNameFilter = true,
line = 2, column = 3, message = 4
}
}
}
}
}
}
```

## [null-ls.nvim](https://github.com/jose-elias-alvarez/null-ls.nvim) config for teal

```
local null_ls = require("null-ls")
null_ls.config {sources = {
null_ls.builtins.diagnostics.teal
}}
require("lspconfig")["null-ls"].setup {}
```
28 changes: 4 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ export PJ_ROOT=$(PWD)
FILTER ?= .*

LUA_VERSION := 5.1
TL_VERSION := 0.14.1
NEOVIM_BRANCH ?= master

DEPS_DIR := $(PWD)/deps/nvim-$(NEOVIM_BRANCH)
NVIM_DIR := $(DEPS_DIR)/neovim

LUAROCKS := $(DEPS_DIR)/luarocks/usr/bin/luarocks
LUAROCKS := luarocks
LUAROCKS_TREE := $(DEPS_DIR)/luarocks/usr
LUAROCKS_LPATH := $(LUAROCKS_TREE)/share/lua/$(LUA_VERSION)
LUAROCKS_INIT := eval $$($(LUAROCKS) --tree $(LUAROCKS_TREE) path) &&
Expand All @@ -26,17 +25,12 @@ $(NVIM_DIR):
CMAKE_BUILD_TYPE=RelWithDebInfo \
CMAKE_EXTRA_FLAGS='-DCI_BUILD=OFF -DENABLE_LTO=OFF'

TL := $(LUAROCKS_TREE)/bin/tl

$(TL): $(NVIM_DIR)
@mkdir -p $$(dirname $@)
$(LUAROCKS) --tree $(LUAROCKS_TREE) install tl $(TL_VERSION)

INSPECT := $(LUAROCKS_LPATH)/inspect.lua

$(INSPECT): $(NVIM_DIR)
@mkdir -p $$(dirname $@)
$(LUAROCKS) --tree $(LUAROCKS_TREE) install inspect
touch $@

LUV := $(LUAROCKS_TREE)/lib/lua/$(LUA_VERSION)/luv.so

Expand All @@ -45,7 +39,7 @@ $(LUV): $(NVIM_DIR)
$(LUAROCKS) --tree $(LUAROCKS_TREE) install luv

.PHONY: lua_deps
lua_deps: $(TL) $(INSPECT)
lua_deps: $(INSPECT)

.PHONY: test_deps
test_deps: $(NVIM_DIR)
Expand Down Expand Up @@ -73,24 +67,10 @@ test: $(NVIM_DIR)

-@stty sane

.PHONY: tl-check
tl-check: $(TL)
$(TL) check teal/*.tl teal/**/*.tl

.PHONY: tl-build
tl-build: tlconfig.lua $(TL) $(LUV)
@$(TL) build
@$(LUAROCKS_INIT) ./etc/add_comments.lua
@echo Updated lua files

.PHONY: gen_help
gen_help: $(INSPECT)
@$(LUAROCKS_INIT) ./gen_help.lua
@echo Updated help

.PHONY: build
build: tl-build gen_help

.PHONY: tl-ensure
tl-ensure: tl-build
git diff --exit-code -- lua
build: gen_help
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Gitter](https://badges.gitter.im/gitsigns-nvim/community.svg)](https://gitter.im/gitsigns-nvim/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Super fast git decorations implemented purely in lua/teal.
Super fast git decorations implemented purely in Lua.

## Preview

Expand Down
65 changes: 30 additions & 35 deletions doc/gitsigns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,11 @@ on_attach *gitsigns-config-on_attach*
watch_gitdir *gitsigns-config-watch_gitdir*
Type: `table[extended]`
Default: >
{
`{
enable = true,
interval = 1000,
follow_files = true
}
follow_files = true,
interval = 1000
}`
<
When opening a file, a libuv watcher is placed on the respective
`.git` directory to detect when changes happen to use as a trigger to
Expand Down Expand Up @@ -685,18 +685,9 @@ base *gitsigns-config-base*
count_chars *gitsigns-config-count_chars*
Type: `table`
Default: >
{
[1] = '1', -- '₁',
[2] = '2', -- '₂',
[3] = '3', -- '₃',
[4] = '4', -- '₄',
[5] = '5', -- '₅',
[6] = '6', -- '₆',
[7] = '7', -- '₇',
[8] = '8', -- '₈',
[9] = '9', -- '₉',
['+'] = '>', -- '₊',
}
`{ "1", "2", "3", "4", "5", "6", "7", "8", "9",
["+"] = ">"
}`
<
The count characters used when `signs.*.show_count` is enabled. The
`+` entry is used as a fallback. With the default, any count outside
Expand Down Expand Up @@ -728,13 +719,13 @@ max_file_length *gitsigns-config-max_file_length*
preview_config *gitsigns-config-preview_config*
Type: `table[extended]`
Default: >
{
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
}
`{
border = "single",
col = 1,
relative = "cursor",
row = 0,
style = "minimal"
}`
<
Option overrides for the Gitsigns preview window. Table is passed directly
to `nvim_open_win`.
Expand All @@ -760,12 +751,12 @@ current_line_blame *gitsigns-config-current_line_blame*
current_line_blame_opts *gitsigns-config-current_line_blame_opts*
Type: `table[extended]`
Default: >
{
`{
delay = 1000,
virt_text = true,
virt_text_pos = 'eol',
virt_text_priority = 100,
delay = 1000
}
virt_text_pos = "eol",
virt_text_priority = 100
}`
<
Options for the current line blame annotation.

Expand All @@ -792,17 +783,17 @@ current_line_blame_formatter_opts

Type: `table[extended]`
Default: >
{
relative_time = false
}
`{
relative_time = false
}`
<
Options for the current line blame annotation formatter.

Fields: ~
• relative_time: boolean

current_line_blame_formatter *gitsigns-config-current_line_blame_formatter*
Type: `string|function`, Default: `' <author>, <author_time> - <summary> '`
Type: `string|function`, Default: `" <author>, <author_time> - <summary> "`

String or function used to format the virtual text of
|gitsigns-config-current_line_blame|.
Expand Down Expand Up @@ -880,7 +871,7 @@ current_line_blame_formatter *gitsigns-config-current_line_blame_formatter*

current_line_blame_formatter_nc
*gitsigns-config-current_line_blame_formatter_nc*
Type: `string|function`, Default: `' <author>'`
Type: `string|function`, Default: `" <author>"`

String or function used to format the virtual text of
|gitsigns-config-current_line_blame| for lines that aren't committed.
Expand All @@ -894,8 +885,12 @@ trouble *gitsigns-config-trouble*
quickfix/location list window.

yadm *gitsigns-config-yadm*
Type: `table`, Default: `{ enable = false }`

Type: `table`
Default: >
`{
enable = false
}`
<
yadm configuration.

word_diff *gitsigns-config-word_diff*
Expand Down
81 changes: 0 additions & 81 deletions etc/add_comments.lua

This file was deleted.

Loading

0 comments on commit 4d63d99

Please sign in to comment.