Skip to content

Commit

Permalink
Merge pull request #38 from joshmu/feat_refactor
Browse files Browse the repository at this point in the history
Feat refactor
  • Loading branch information
joshmu authored Apr 28, 2024
2 parents 8613bf0 + 7301cff commit 9e63b30
Show file tree
Hide file tree
Showing 7 changed files with 537 additions and 722 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/publish-vscode-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:

build:
needs: semantic-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
Expand Down Expand Up @@ -56,9 +57,11 @@ jobs:
platform: darwin
arch: arm64
npm_config_arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-node@v4
with:
node-version: 20
Expand Down
35 changes: 30 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
# Change Log
# Changelog

All notable changes to the "periscope" extension will be documented in this file.
All notable changes to this project will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
#### 1.6.1 (2024-04-28)

## [Unreleased]
##### New Features

- Initial release
- with shared context ([d6cf1693](https://github.com/joshmu/periscope/commit/d6cf169376cfc59ea68bb2b8d666e22ffe13e81c))
- when no results show origin document ([dfd176d7](https://github.com/joshmu/periscope/commit/dfd176d791fef6152a222ed1077d58d36d6faf28))
- improve logs ([cbfc7916](https://github.com/joshmu/periscope/commit/cbfc7916aef333f4e54dd86aef2138fc68d7c79f))
- include @semantic-release/git to update package.json versioning ([c994ade2](https://github.com/joshmu/periscope/commit/c994ade2d0fffb970cf1e5130f8bdee765e5c311))
- update vscode ripgrep package ([a6c15c6f](https://github.com/joshmu/periscope/commit/a6c15c6f9e1fa9a24b3d60328f3c92ffbd3b078b))
- pipeline publish integration ([416b4ec0](https://github.com/joshmu/periscope/commit/416b4ec084c2fb8f60f37a7de61fcd179a9d9b83))
- option to apply custom rg commands ([7e38da92](https://github.com/joshmu/periscope/commit/7e38da929499a7065c5a8e77b346f568c88283f6))
- rg actions shortcut ([dc7c622d](https://github.com/joshmu/periscope/commit/dc7c622d07a9881c8fb2f674bd329a6f9fc42e77))
- improved rg menu actions ([13002dbc](https://github.com/joshmu/periscope/commit/13002dbcd10a50c994ca1944168574fc69f85b84))
- optional rg menu actions ([37d1829c](https://github.com/joshmu/periscope/commit/37d1829c911ed97efe7ad89fc53acadabd285d3b))
- update default color so light theme is valid ([a44d82b6](https://github.com/joshmu/periscope/commit/a44d82b6288e426781cca968b2b9d63902cb07db))
- use white color for peek highlight default ([bec3d889](https://github.com/joshmu/periscope/commit/bec3d889f50a4db8d77015374bf8f0313f424678))
- peek highlight ([47d38dc0](https://github.com/joshmu/periscope/commit/47d38dc077079360d752760c8952354985f17e14))
- jump to native search, additional display options ([fe56a836](https://github.com/joshmu/periscope/commit/fe56a836348bad8a4e1ad17c7767d725b7daa6ee))

##### Bug Fixes

- rg menu actions resolved via app state machine, additional refactor also ([c34ae789](https://github.com/joshmu/periscope/commit/c34ae7898442be053faa7c252b68d6a5daa740b6))
- cursor col position ([a75608e3](https://github.com/joshmu/periscope/commit/a75608e3586bc4fa9f12190aea624798db8bdd00))
- improve handling of child processes ([49580f8e](https://github.com/joshmu/periscope/commit/49580f8ea6ff72cc892ea505c20c227d67b8a6bf))
- rg line json parse error handling ([1c4d9589](https://github.com/joshmu/periscope/commit/1c4d9589492d952275e57f8ebc3003142507d823))
- pipeline publish condition to invoke once matrix complete, semantic-release will automate tag creation ([7db87476](https://github.com/joshmu/periscope/commit/7db874761d768774c5d1deb2f03786bab304bf01))
- pipline vscode publish platform compatibility ([f9a52cee](https://github.com/joshmu/periscope/commit/f9a52cee6f77b84571b78d4974833d09d4c2f369))
- extension OS compatibility ([ec117db7](https://github.com/joshmu/periscope/commit/ec117db7f65ab2d2e2b1108bf00050912af52af2))
- allow new rg install to define correct platform binary ([c0ac93ff](https://github.com/joshmu/periscope/commit/c0ac93ff05b6480eef89c89ae4ee0696b6cd79fb))
- quick pick item show all ([e113b22c](https://github.com/joshmu/periscope/commit/e113b22cc09ae3234de85b5c09a8b2b0130ceced))
58 changes: 58 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Contributing to Periscope

Thank you for your interest in contributing to Periscope! We welcome contributions from the community to help improve and enhance the extension.

## Getting Started

### Prerequisites

- [Git](https://git-scm.com/)
- [NodeJS](https://nodejs.org/en/)
- [Npm](https://www.npmjs.com/get-npm)

### General Process

To get started with contributing, please follow these steps:

1. Fork the repository and clone it to your local machine.
2. Install the required dependencies by running `npm install`.
3. Make your changes or additions to the codebase.
4. Test your changes to ensure they work as expected.
5. Commit your changes and push them to your forked repository.
6. Open a pull request to the main repository.

### Running the extension

Open the extension project in VS Code (e.g. by running `code .` in the project folder).

To run the extension in development mode:

1. Run the `View: Show Run and Debug` command (<kbd>Cmd</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>).
1. Select the green play icon, or press <kbd>F5</kbd>.

You can read through the [Running and debugging your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension#run-the-extension) section of the official documentation.

### Troubleshooting

Logs can be found by running `Developer: Show Logs ...` command (using `cmd+shift+p`) and selecting `Extension Host`.

You can always use debugger when you are running the extension in development mode.

## Code Guidelines

Please adhere to the following guidelines when contributing to the project:

- Follow the coding style and conventions used in the existing codebase.
- Write clear and concise code with appropriate comments where necessary.
- Ensure your code is well-tested and does not introduce any regressions.
- Document any new features or changes in the appropriate sections.

## Issue Reporting

If you encounter any bugs, issues, or have feature requests, please open an issue on the repository. Provide as much detail as possible, including steps to reproduce the issue and any relevant error messages.

## Thank you

We appreciate your contributions and look forward to your involvement in improving Periscope!

Happy coding!
82 changes: 53 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
# Periscope 🫧

## Features
Periscope is a VSCode extension that supercharges your ability to search workspace contents using [ripgrep](https://github.com/BurntSushi/ripgrep), providing an intuitive interface with real-time previews of search results.

Periscope is a Vscode extension for high powered workspace contents search utilising [ripgrep](https://github.com/BurntSushi/ripgrep) with on the fly peek across result suggestions.
_Inspired by nvim's [telescope](https://github.com/nvim-telescope/telescope.nvim)_

![Demo](https://github.com/joshmu/periscope/blob/master/assets/demo.gif?raw=true)
## Key Features

_Inspired by nvim's [telescope](https://github.com/nvim-telescope/telescope.nvim)_
- **Fast Search**: Utilizes `ripgrep` for lightning-fast search capabilities.
- **Real-Time Preview**: See preview of files right in the search pane as you navigate through search results.
- **Customizable**: Extensive configuration options to tailor search behavior and UI to your needs.

![Demo](https://github.com/joshmu/periscope/blob/master/assets/demo.gif?raw=true)

## Instructions
## Usage Instructions

1. Assign a keybinding such as `<super> + p` to invoke the `periscope.search` command. Otherwise you can use the command prompt and search for **periscope**.
2. Input your query and move through the suggested results, the editor will reflect the current highlighted suggested item.
3. Hit enter to open the file or cancel to return to your original active editor
1. **Invoke Search**: Assign a keybinding such as `<super> + p` to invoke the `periscope.search` command. You can also access it via the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P`) and search for **periscope**.
2. **Search and Preview**: Enter your query to see the search results dynamically. Navigate through results to preview files directly in the editor.
3. **Open or Cancel**: Press `Enter` to open the highlighted file or `Esc` to cancel and return to your work.

## Requirements

Vscode configuration _Editor: Enable Preview_ must be enabled.
For optimal performance, ensure that the VSCode configuration _Editor: Enable Preview_ is enabled. This allows files to be previewed before opening them completely.

## Extension Settings

This extension contributes the following settings:

- `periscope.search`: Enable Periscope Search

### Configuration Options
### Configuration

- `rgOptions`: Additional options to pass to the 'rg' command, you can view all options in your terminal via 'rg --help'.
- `rgGlobExcludes`: Additional glob paths to exclude from the 'rg' search, eg: '**/dist/**'.
- `rgPath`: Optional path to the `rg` binary. If not specified, the ripgrep bundled with vscode will be used.
- `addSrcPaths`: Additional source paths to include in the rg search. You may want to add this as a workspace specific setting.
- `rgMenuActions`: Create menu items which can be selected prior to any query, these items will be added to the ripgrep command to generate the results. Eg: Add `{ "label": "JS/TS", "value": "--type-add 'jsts:*.{js|ts|tsx|jsx}' -t jsts" },` as a menu option to only show js & ts files in the results.
- `rgQueryParams`: Match ripgrep parameters from the input query directly. E.g: `{ "param": \"-t $1\", "regex": \"^(.+) -t ?(\\w+)$\" },` will translate the query `hello -t rust` to `rg 'hello' -t rust`.
- `rgQueryParams`: Match ripgrep parameters from the input query directly. E.g: `{ "regex": \"^(.+) -t ?(\\w+)$\", "param": \"-t $1\" },` will translate the query `hello -t rust` to `rg 'hello' -t rust` to enable a filetype filter.
- `rgQueryParamsShowTitle`: When a ripgrep parameter match from the list in `rgQueryParams`, the quick pick will show the matched result as a preview in the title bar.
- `startFolderDisplayIndex`: The folder index to display in the results before '...'.
- `startFolderDisplayDepth`: The folder depth to display in the results before '...'.
Expand All @@ -45,11 +49,13 @@ This extension contributes the following settings:
- `peekBorderWidth`: Change the peek border width (px)
- `peekBorderStyle`: Change the peek border style (solid, dashed, inset, double, groove, outset, ridge)

### Other commands
### Advanced Configurations

Detailed examples for setting up advanced search parameters and UI customization are provided below to help you tailor Periscope to fit your workflow.

#### periscope.openInHorizontalSplit

Open the selected entry in a horizontal split.
Open the result preview in a horizontal split.

Add a keybinding (`keybindings.json`):

Expand All @@ -61,41 +67,59 @@ Add a keybinding (`keybindings.json`):
}
```

### Configuration Examples

#### periscope.rgQueryParams

Create shortcuts for common ripgrep search queries via regex matching against your current query. This provides a way to map your query to ripgrep parameters via capture groups in the regex.

Add the following to your `settings.json`:

```json
"periscope.rgQueryParams": [
{
// filter the results to a folder
// Query: redis -m module1 => rg 'redis' -g '**/*module1*/**'
"param": "-g '**/*$1*/**' -g '!**/node_modules/**'",
"regex": "^(.+) -m ([\\w-_]+)$"
// Query: "redis -m module1"
// After: "rg 'redis' -g '**/*module1*/**'"
"regex": "^(.+) -m ([\\w-_]+)$",
"param": "-g '**/*$1*/**' -g '!**/node_modules/**'"
},
{
// filter the results to a folder and filetype
// Query: redis -m module1 yaml => rg 'redis' -g '**/*module1*/**/*.yaml'
"param": "-g '**/*$1*/**/*.$2'",
"regex": "^(.+) -m ([\\w-_]+) ([\\w]+)$"
// Query: "redis -m module1 yaml"
// After: "rg 'redis' -g '**/*module1*/**/*.yaml'"
"regex": "^(.+) -m ([\\w-_]+) ([\\w]+)$",
"param": "-g '**/*$1*/**/*.$2'"
},
{
// filter the results that match a glob
// Query: redis -g *module => rg 'redis' -g '*module'
"param": "-g '$1'",
"regex": "^(.+) -g (.+)$"
// Query: "redis -g *module"
// After: "rg 'redis' -g '*module'"
"regex": "^(.+) -g (.+)$",
"param": "-g '$1'"
},
{
// filter the results to rg filetypes
// Query: redis -t yaml => rg 'redis' -t yaml
"param": "-t $1",
"regex": "^(.+) -t ?(\\w+)$"
// Query: "redis -t yaml"
// After: "rg 'redis' -t yaml"
"regex": "^(.+) -t ?(\\w+)$",
"param": "-t $1"
},
{
// filter the results that match a file extension through a glob
// Query: redis *.rs => rg 'redis' -g '*.rs'
"param": "-g '*.$1'",
"regex": "^(.+) \\*\\.(\\w+)$"
"regex": "^(.+) \\*\\.(\\w+)$",
"param": "-g '*.$1'"
}
],
```

## Troubleshooting

For common issues and troubleshooting guidance, please visit the [Issues](https://github.com/joshmu/periscope/issues) section of our GitHub repository. If you encounter a problem not covered there, feel free to open a new issue.

## Contributing

Interested in contributing to Periscope? We welcome contributions of all forms. Please visit our [Contributions Page](https://github.com/joshmu/periscope/blob/master/CONTRIBUTING.md) for more information on how to get involved.

## Feedback and Support

For support with using Periscope or to provide feedback, please [open an issue](https://github.com/joshmu/periscope/issues/new) in our GitHub repository.
Loading

0 comments on commit 9e63b30

Please sign in to comment.