-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tracer and improve frontend devex (#28)
* Add basic Tracer tests * Be more careful about parallel resources * Frontend filter * CLI Config and docs
- Loading branch information
Showing
23 changed files
with
1,745 additions
and
288 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ target | |
|
||
project/metals.sbt | ||
website | ||
node_modules | ||
.scala-build |
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,72 @@ | ||
# Tracer | ||
|
||
![2022-08-27 17 50 05](https://user-images.githubusercontent.com/1052965/187040059-f6e0c08b-7c76-4899-b370-0e8ada0c4819.gif) | ||
|
||
|
||
A UI tool for capturing the LSP requests and responses that are exchanged between the client and the server. | ||
|
||
It doesn't matter what the target LSP is implemented with, as we only intercept JSONRPC payloads sent to stdin and stdout. | ||
|
||
Currently, primary method of distribution is via [Coursier](https://get-coursier.io/docs/overview). | ||
|
||
To integrate with an LSP of your choosing, you need to have access to the CLI command that launches is. | ||
|
||
The principle remains the same regardless of the editor: | ||
|
||
``` | ||
cs launch tech.neander:langoustine-tracer_3:latest.release -- <lsp command> | ||
``` | ||
|
||
where `<lsp command>` is passed as a list of arguments, **not as a string**. | ||
|
||
### Packaging with coursier | ||
|
||
You can make your life considerably easier by using the bootstrap command that Coursier provides: | ||
|
||
``` | ||
cs boostrap tech.neander:langoustine-tracer_3:latest.release -f -o langoustine-tracer | ||
# now you can use ./langoustine-tracer, | ||
# put it somewhere on your PATH so that it's globally avalable | ||
# and use it like this: | ||
langoustine-tracer --port 9911 my-awesome lsp --stdin true | ||
``` | ||
|
||
Alternatively, if your system was setup with coursier (i.e. the path where it puts | ||
installed applications is in your system's `PATH`), then life is even easier, | ||
hedonistic even: | ||
|
||
``` | ||
cs install tech.neander:langoustine-tracer_3:latest.release | ||
``` | ||
|
||
**From this point in the document we assume that you somehow installed this app in a global location** | ||
|
||
For example, if your command to launch the LSP is `my-awesome lsp --stdin true`, then to trace it you need to use the following command: | ||
|
||
``` | ||
langoustine-tracer my-awesome lsp --stdin true | ||
``` | ||
|
||
Tracer will interpret everything after the **first `--`** as the command that launches your LSP. | ||
Everything **before first `--`** will be used to configure the tracer itself. | ||
|
||
## Tips | ||
|
||
### Changing port | ||
|
||
By default, it will start the server at the port **9977** but you can change that using the `--port` argument: | ||
|
||
``` | ||
langoustine-tracer --port 9911 my-awesome lsp --stdin true | ||
``` | ||
|
||
### Local development | ||
|
||
If you are working on the tracer itself, you can globally alias `langoustine-tracer` to a local installation: | ||
|
||
``` | ||
alias langoustine-tracer=<path-to-langoustine>/modules/tracer/backend/target/jvm-3/universal/stage/bin/langoustine-tracer | ||
``` | ||
|
||
That launcher is created by running `sbt tracer/stage` |
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,6 +1,10 @@ | ||
index: index.md | ||
subsection: | ||
- title: Tracer | ||
page: tracer.md | ||
|
||
- title: Examples | ||
page: examples.md | ||
|
||
- title: Contributing guide | ||
page: CONTRIBUTING.md |
21 changes: 0 additions & 21 deletions
21
modules/tracer/backend/src/main/resources/assets/index.html
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
package langoustine.tracer | ||
|
||
import cats.implicits.* | ||
import com.monovore.decline.* | ||
import cats.data.NonEmptyList | ||
|
||
case class Config(port: Int, cmd: NonEmptyList[String]) | ||
|
||
object Config: | ||
|
||
val portOpt = | ||
val portHelo = "Port to start Tracer on" | ||
Opts | ||
.option[Int]("port", portHelo) | ||
.orElse(Opts.env[Int]("PORT", portHelo)) | ||
.withDefault(9977) | ||
|
||
val lsp = Opts.arguments[String]("lspCommand") | ||
|
||
val config = (portOpt, lsp).mapN(Config.apply) | ||
|
||
val command = Command( | ||
name = "tracer", | ||
header = "Launch Langoustine Tracer" | ||
) { | ||
config | ||
} | ||
end Config |
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.