Skip to content

Commit

Permalink
Upstream.logs -- fixing logging for debugging and upgradig demos (#20)
Browse files Browse the repository at this point in the history
* feat: added logger debugging utils from cli & refactored cli completions

    - 'src/logger.ts' was editted add minor extensions in functionality
    - 'src/cli.ts' had chunks of comments removed
    - 'src/utils/get-lsp-completions.ts' refactored auto hardcoded
      arrays of strings (that would be formatted), to fish-shell
      strings wrapped in: `<string>`

* docs: updated demo.gif in README.md to use local PR provided content

* docs: updated README.md formatting

* feat: added .all-contributorsrc and other setup configs

* docs: updating README.md

* docs: updated README.md to better format

* chore: update image and comment out pros of fish shell section

To update the project with a new image and comment out the section highlighting the pros of fish shell for further enhancement.

Changes:
- Update the image link in the README file to display a new image.
- Comment out the section highlighting the pros of fish shell for the time being.
  • Loading branch information
ndonfris committed Apr 30, 2024
1 parent 984b158 commit b722b82
Show file tree
Hide file tree
Showing 11 changed files with 425 additions and 384 deletions.
15 changes: 15 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"projectName": "fish-lsp",
"projectOwner": "ndonfris",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"./docs/CONTRIBUTING.md"
],
"imageSize": 25,
"commit": false,
"commitConvention": "eslint",
"contributors": [],
"contributorsPerLine": 7,
"linkToUsage": false
}
241 changes: 126 additions & 115 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,114 +1,132 @@
# fish-lsp
<h1 style="text-align: center; display: flex;">
<img alt="" src="https://github.com/ndonfris/fish-lsp.dev/blob/ndonfris-patch-1/coloricon.svg" width="25px" height="auto" style="padding-top: auto; padding-bottom: auto;" /> FISH-LSP
</h1>

- [SUMMARY](#summary)
- [INSTALLATION](#installation)
- [FEATURES](#features)
- [CONTRIBUTING](./docs/CONTRIBUTING.md)
- [ROADMAP](./docs/ROADMAP.md)
- [WIKI](#viewing-the-wiki)
- [SOURCES](#sources)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ndonfris/fish-lsp/eslint.yml?branch=master&labelColor=%23181939)
![License](https://img.shields.io/github/license/ndonfris/fish-lsp?&labelColor=%23181939&color=b88af3)
![Github Created At](https://img.shields.io/github/created-at/ndonfris/fish-lsp?logo=%234e6cfa&label=created&labelColor=%23181939&color=%236198f5)

## Summary
A [Language Server Protocol (LSP)](https://lsif.dev/) tailored for the [fish shell](https://github.com/microsoft/vscode-languageserver-node/tree/main/server/src/common).
This project aims to enhance the coding experience for fish, by introducing a suite of
intelligent features like auto-completion, scope aware symbol analysis, per-token hover
generation, and [many others](#features).

A __feature-rich__, __extensible__, and __blazingly fast__ [language-server](https://github.com/microsoft/vscode-languageserver-node/tree/main/server/src/common) for the [fish-shell](https://fishshell.com/).
Uses [tree-sitter](https://tree-sitter.github.io/tree-sitter/), [tree-sitter-fish](https://github.com/ram02z/tree-sitter-fish), [yarn](https://yarnpkg.com/) and [typescript](https://www.typescriptlang.org/).
Implements both standard & non-standard features from the [language-server-protocol](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#headerPart), to be connected to a language-client ([neovim](https://neovim.io/),[coc.nvim](https://github.com/neoclide/coc.nvim), [vscode](https://code.visualstudio.com/), [etc.](https://github.com/ndonfris/fish-lsp-language-clients)).
__More info on the [wiki](https://github.com/ndonfris/fish-lsp/wiki).__
The LSP describes __both__ a [server](#server-usage) and [client's](#client-usage) communication abilities.
Text editor's (_or any other equivalent form of_ __langauge client__) are then able to choose which general
programming features will be implemented. This leaves current and future possibilities
supported by the server open ended.

![fish-lsp --help](https://i.imgur.com/M6Zm3yW.png)
In short, the overall project goal is to produce an editor agnostic developer
environment for fish.

<!-- ![helpmsg](https://i.imgur.com/Xypl9PN.png) -->
<!-- ![alt](https://player.vimeo.com/video/930061064?h=eaf4bb5804) -->
<!-- <iframe src="https://player.vimeo.com/video/930061064?h=eaf4bb5804" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> -->
<!-- <iframe src="https://player.vimeo.com/video/930061064?h=eaf4bb5804" width="640" height="360" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe> -->
<!-- <p><a href="https://vimeo.com/930061064">fish-lsp demo</a> from <a href="https://vimeo.com/user217605615">nick donfris</a> on <a href="https://vimeo.com">Vimeo</a>.</p> -->
### Client Usage

## Installation

1. Create the `fish-lsp` command via one of the following methods ___(building
from source is recommended)___

<details>
<!-- <summary>Using npm <b><i><ins>(UNTESTED, install from source is recommended)</ins></i></b>&nbsp;&nbsp;&nbsp;&nbsp;<img alt="Static Badge" src="https://img.shields.io/badge/recommended-white?style=plastic&logo=npm&logoColor=%235f5fd7&labelColor=%23000&color=%235f5fd7" wight="50%" /> -->
<summary>Using npm <b><i><ins>(UNTESTED)</ins></i></b>&nbsp;&nbsp;&nbsp;&nbsp;<img alt="Static Badge" src="https://img.shields.io/badge/NOT_recommended-white?style=plastic&logo=npm&logoColor=%235f5fd7&labelColor=%23000&color=%235f5fd7" />
</summary>

```fish
npm i -g fish-lsp
```
</details>
<details>
<summary>Build from source&nbsp;&nbsp;&nbsp;&nbsp;<img alt="Static Badge" src="https://img.shields.io/badge/for_contributing-blue?style=plastic&logo=devdotto&labelColor=grey" >
</summary>
![demo.gif](https://github.com/ndonfris/fish-lsp.dev/blob/ndonfris-patch-1/new_output.gif?raw=true)

- clone the repository
> [!NOTE]
> _Please submit other demo's in_ [show & tell](https://github.com/ndonfris/fish-lsp/discussions/categories/show-and-tell) _discussion_
```fish
git clone https://github.com/ndonfris/fish-lsp.git
```
### Server Usage

- enter the directory
<!-- ```bash -->
<!-- fish-lsp --help -->
<!-- ``` -->
<!---->
<!-- <details> -->
<!-- <summary> Generated Output </summary> -->

```fish
cd ./fish-lsp
```
![fish-lsp --help](https://github.com/ndonfris/fish-lsp.dev/blob/master/public/help-msg-new.png)

- run the install commands:
<!-- </details> -->

```fish
yarn install # install dependencies
```
## Installation

</details>
<details>
<summary>Using release binaries <b><i><ins>(UNTESTED)</ins></i></b>&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/ndonfris/fish-lsp/releases"><img alt="Static Badge" src="https://img.shields.io/badge/release%20branch-black?style=plastic&logo=powershell&logoColor=%23ce3df3&labelColor=%23000&color=%23ce3df3" ></a></summary>
> __dependencies:__ `yarn@1.22.22`, `node@21.7.1`, `fish@3.7.1`
> ___Currently is not recommended for use as the release binaries are error
> prone and not fully tested. Future `tsup` builds, should provide stability
> across different installation enviornments.___
Building from source is __the only currently recommended installation method__, as we improve
other methods of the installation process (Don't use __releases__ or __npm package__).
Contributions to help enhance installation options are greatly appreciated!

- navigate to the [releases](https://github.com/ndonfris/fish-lsp/master/releases), and download the file for your OS
1. Clone the repo

- Rename file to fish-lsp (make sure the binary is executable as well)
```bash
git clone https://github.com/ndonfris/fish-lsp
# cd fish-lsp
```

```fish
# cd to downloaded location
mv fish-lsp-linux fish-lsp
chmod +x ./fish-lsp
```
1. Install the dependencies & run the setup handler scripts

- move the binary to your __\$PATH__:
```bash
yarn install
```

```fish
mv ./fish-lsp ~/.local/bin/fish-lsp
```
1. __Optional:__ Check that the project successfully compiled & linked

</details>
```bash
# ./bin/fish-lsp --help
fish-lsp --help
```

1. Setup the project in the [client](https://github.com/ndonfris/fish-lsp/wiki/Client-Configurations) of your choice

1. Provide the `fish-lsp` command to start the server from a language client
```json
{
"languageserver": {
"fish-lsp": {
"command": "fish-lsp",
"args": ["start"],
"filetypes": ["fish"]
"fish-lsp": {
"command": "fish-lsp",
"filetypes": ["fish"],
"args": ["start"],
"revealOutputChannelOn": "info",
"initializationOptions": {
"workspaces": {
"paths": {
"defaults": [
"$HOME/.config/fish",
"/usr/share/fish"
]
}
}
}
}
}
```
> configuration shown for "coc.nvim"
> lua and other language-client configuration syntax's
> can be built by fish-lsp startup-configuration <filetype>.
> Demo shows different hover documentation, go-to definition, go-to references
> and some other features.
<center>
```

> neovim client using [coc.nvim](https://github.com/neoclide/coc.nvim) configuartion. Snippet located inside [coc-settings.json](https://github.com/neoclide/coc.nvim/wiki/Language-servers#register-custom-language-servers) `"languageserver"` key

## Why?

The creation of this project was driven by a vision to bridge the gap in tooling for the
fish shell, independently separating the shell's community by text-editor/IDE.
<!-- ### Pros of fish shell -->
<!---->
<!-- Fish stands out among shell environments due to its advanced, user-friendly language -->
<!-- design, which is inherently more structured and intuitive than traditional shells. This modern -->
<!-- design simplifies script development, enhances readability, and supports robust error handling, -->
<!-- making it an ideal candidate for a dedicated LSP. By leveraging Fish’s unique features through an LSP, -->
<!-- developers can harness its full potential, benefiting from intelligent autocomplete, syntax highlighting, -->
<!-- and real-time feedback that align seamlessly with Fish's syntax. Building an LSP for -->
<!-- Fish not only taps into these innate capabilities but also enriches the user experience, -->
<!-- making advanced shell scripting more accessible and productive. -->

![usage gif](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExaWkwcDY5aTg1OGltbDV6cGh4cGU4a204cGd1aHd6MmNpMWRrZ2d1biZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/PdSL9U8GXwV8xECE8k/giphy.gif)
### Simplicity of fish's syntax

</center>
Compared to other programming languages that feature LSP implementations, the syntax and
language design of fish are notably straightforward. This simplicity theoretically
facilitates the development of language server features, making them easier to
conceptualize, document, and test. Additionally, the straightforward nature of fish’s
design lowers the barrier to entry for understanding the project's core architecture,
making it less daunting for users to contribute their own feature requests and enhancements.
### Challenges
Since its inception, __fish-lsp__ has undergone substantial changes, requiring frequent refactoring
and even the temporary exclusion of certain features to maintain compatibility and performance
with evolving LSP standards. These modifications have often led to extensive rewrites of
significant sections throughout the project. As a result, some features are currently on hold until
they can be seamlessly integrated into the updated framework.
Your sponsorship and/or contributions are vital to continuing the development and refinement of __fish-lsp__,
ensuring it remains a valuable tool for the community.
## Features
Expand All @@ -134,36 +152,29 @@ __More info on the [wiki](https://github.com/ndonfris/fish-lsp/wiki).__
| __Client Tree__ | Shows the defined scope as a Tree | ✅ |
| __Indexing__ | Indexes all commands, variables, and functions | ✅ |
## Viewing the Wiki
The [wiki](https://github.com/ndonfris/fish-lsp/wiki) Contains more information on the project. Project is still in it's early releases, so the wiki
information is subject to change. Contains ['minimal' client submodules](https://github.com/ndonfris/fish-lsp-language-clients),
useful snippets, and bleeding edge feature documentation.

## Sources
This project aims to be a more feature rich alternative to some of it's predecessors,
while maintaining an editor agnostic server implantation. The following sources were
major influences on the project's overall design and structure.

- __Official Documentation__
- [__LSP__](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#headerPart)
- [__LSIF__](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#headerPart)
- [__vscode-extension-samples__](https://github.com/microsoft/vscode-extension-samples/tree/main)
- [__Tree-Sitter__](https://tree-sitter.github.io/tree-sitter/)
- [__Tree-Sitter-Fish__](https://github.com/ram02z/tree-sitter-fish)

- __Related/Similiar projects__
- [vscode-languageserver-node/testbed](https://github.com/microsoft/vscode-languageserver-node/tree/main/testbed)
- [awk-language-server](https://github.com/Beaglefoot/awk-language-server/tree/master/server)
- [bash-language-server](https://github.com/bash-lsp/bash-language-server/tree/main/server/src)
- [coc.fish](https://github.com/oncomouse/coc-fish)
- [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server#running-the-language-server)
- [coc-tsserver](https://github.com/neoclide/coc-tsserver)

- __Important Packages__
- [vscode-jsonrpc](https://www.npmjs.com/package/vscode-jsonrpc)
- [vscode-languageserver](https://github.com/Microsoft/vscode-languageserver-node)
- [vscode-languageserver-textdocument](https://github.com/Microsoft/vscode-languageserver-node)

- __Default Implementation Git Repos__
- [client implementation](https://github.com/microsoft/vscode-languageserver-node/blob/main/client/src/common)
- [server implementation](https://github.com/microsoft/vscode-languageserver-node/tree/main/server/src/common)
## Additional Resources
For more detailed information about using and contributing to the fish-lsp, please visit the following resources:
- [Contributing](./docs/CONTRIBUTING.md) - Docs describing how to contribute to the fish-lsp project.
- [Roadmap](./docs/ROADMAP.md) - Goals for future project releases.
- [Wiki](https://github.com/ndonfris/fish-lsp/wiki) - further documentation and knowledge relevant to the project
- [Discussions](https://github.com/ndonfris/fish-lsp/discussions) - interact with our maintainers
- [Site](https://fish-lsp.dev/) - Web Homepage
- [Client Examples](https://github.com/ndonfris/fish-lsp/wiki/Client-Configurations) - Testable language client configuartions
<!-- Contributors list @via: https://allcontributors.org/docs/en/bot/installation -->
## Contributing
Contributions are what make the open-source community such a powerful and diverse platform for development.
Special thanks to everyone who has helped on the project.
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/ndonfris/fish-lsp/blob/master/LICENSE) file.
10 changes: 10 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ Once these steps are complete, you can then begin testing locally. __Forking__ _
project is encouraged._

Upon completing a change, submit a [PR](https://github.com/ndonfris/fish-lsp/pulls).

## Contributors
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

35 changes: 18 additions & 17 deletions docs/MAN_FILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Start the language server.
`min` or `bare`
Start the language server without any language-specific features.

`logger`
Access the logger

`info`
show the build info of fish-lsp

Expand All @@ -42,31 +45,29 @@ Show help message and exit.

## EXAMPLES

Start the `fish-lsp` language server, with the default configuration:
Start the `fish-lsp` language server, with the default configuration:

```sh
> fish-lsp start
```
```fish
>_ fish-lsp start
```

Start the `fish-lsp` language server, with the bare minimum configuration:
Start the `fish-lsp` language server, with the bare minimum configuration:

```sh
> fish-lsp bare --enable hover
```
```fish
>_ fish-lsp bare --enable hover
```

Show the path to the `fish-lsp` language server binary:
Show the path to the `fish-lsp` language server binary:

```sh
> fish-lsp complete > ~/.config/fish/completions/fish-lsp.fish
```
```fish
>_ fish-lsp complete > ~/.config/fish/completions/fish-lsp.fish
```

## SEE ALSO

__website:__ _https://fish-lsp.dev/_

__repo:__ _https://github.com/ndonfris/fish-lsp_

__fish website:__ _https://fishshell.com/_
__website:__ _https://fish-lsp.dev/_
__repo:__ _https://github.com/ndonfris/fish-lsp_
__fish website:__ _https://fishshell.com/_

## AUTHOR

Expand Down
4 changes: 4 additions & 0 deletions docs/man/fish-lsp.1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Start the language server\.
.br
Start the language server without any language\-specific features\.
.P
\fBlogger\fP
.br
Access the logger
.P
\fBinfo\fP
.br
show the build info of fish\-lsp
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.4.0",
"all-contributors-cli": "^6.26.1",
"chai": "^5.1.0",
"eslint": "^8.0.1",
"eslint-config-love": "^44.0.0",
Expand Down
Loading

0 comments on commit b722b82

Please sign in to comment.