Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Create Key Command #9

Merged
merged 24 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
50e65c9
wip: Adding command support
Myzel394 Apr 24, 2024
eed1e27
feat: Add first wip for inserting custom keys
Myzel394 Apr 24, 2024
98cdf4c
fix: Fix key insertion
Myzel394 Apr 26, 2024
d7e2125
fix: Fix comma insertion
Myzel394 Apr 26, 2024
fbc1aa0
fix: Improvements
Myzel394 Apr 26, 2024
b8ba2ec
feat: Add option for custom mappings
Myzel394 Apr 26, 2024
55bdb80
fix: Properly write arrays; improve parser
Myzel394 Apr 27, 2024
ca9cbbd
fix: Improve general key descriptor and handler
Myzel394 Apr 27, 2024
48503b7
fix: Improve key extractor; Allow more patterns
Myzel394 Apr 27, 2024
2f751e5
fix: Improve writing keys; general improvements
Myzel394 Apr 27, 2024
e427c5f
feat: Add luaunit
Myzel394 Apr 27, 2024
342823d
test: Add tests for utils module
Myzel394 Apr 27, 2024
9d581c5
feat(ci-cd): Run lua tests on pull requests
Myzel394 Apr 27, 2024
e0323d2
fix(ci-cd): Recursively checkout submodules
Myzel394 Apr 27, 2024
9435fbe
fix: Add luaunit as submodule
Myzel394 Apr 27, 2024
ec73267
Merge pull request #10 from Myzel394/add-tests
Myzel394 Apr 27, 2024
a287e40
fix: Remove wrong bracket expansion
Myzel394 Apr 27, 2024
85c097b
fix: Correctly determine required remaining keys if some already exist
Myzel394 Apr 27, 2024
49d5a25
fix: Fix starting bracket missing on key insertion
Myzel394 Apr 27, 2024
6661188
fix: Properly handle top level arrays
Myzel394 Apr 28, 2024
b7ac8e8
docs: Add info about inserting keys
Myzel394 May 1, 2024
1c2fe2b
docs: Add minified json hint
Myzel394 May 1, 2024
65cdbb3
fix: Improve edge case where file lines is shorter than BUFFER_SIZE
Myzel394 May 1, 2024
47775bb
fix: Small improvements
Myzel394 May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Run tests

on:
pull_request:

jobs:
debug-builds:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install Lua
uses: leafo/gh-actions-lua@v10
with:
luaVersion: "5.4.6"

- name: Run tests
run: lua -v ./tests/$(ls ./tests)

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "luaunit"]
path = luaunit
url = https://github.com/bluebird75/luaunit
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ It's completely customizable and even supports highlighting of the values.
## Features

* 🔍 Search for deeply nested keys - `expo.android.imageAsset.0.uri`
* 👀 Insert nested keys quickly into your buffer
* 🎨 See values with their correct syntax highlighting (numbers, strings, booleans, null; configurable)
* 💻 Use your LSP or the built-in JSON parser
* 🗑 Values automatically cached for faster navigation
Expand Down Expand Up @@ -67,6 +68,25 @@ Go to a JSON file and run:
```lua
:Telescope jsonfly


Now you can search for keys, subkeys, part of keys etc.

### Inserting Keys

JSON(fly) supports inserting your current search prompt into your buffer.

If you search for a key that doesn't exist you can add it to your buffer by pressing `<C-a>` (CTRL + a).

You can enter nested keys, arrays, indices, subkeys etc. JSON(fly) will automatically manage everything for you.

The following schemas are valid:

* Nested keys: `expo.android.imageAssets.`
* Array indices: `expo.android.imageAssets.0.uri`, `expo.android.imageAssets.3.uri`, `expo.android.imageAssets.[3].uri`
* Escaping: `expo.android.tests.\0.name` -> Will not create an array but a key with the name `0`

Please note: JSON(fly) is intended to be used with **human-readable** JSON files. Inserting keys won't work with minified JSON files.

## See also

* [jsonpath.nvim](https://github.com/phelipetls/jsonpath.nvim) - Copy JSON paths to your clipboard
Expand Down
Loading
Loading