Skip to content

Commit

Permalink
refactor: tidy-up old lsp name (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelkaporin authored Mar 10, 2022
1 parent c03c9db commit 7cfc481
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ builds:
- goarch: arm64
goos: windows
ldflags:
- -s -w -X github.com/snyk/snyk-lsp/config.Version={{.Version}}
- -s -w -X github.com/snyk/snyk-ls/config.Version={{.Version}}
mod_timestamp: "{{ .CommitTimestamp }}"
hooks:
post:
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Snyk Language Server (Snyk-LSP)
# Snyk Language Server (Snyk-LS)
[![Build Go binaries](https://github.com/snyk/snyk-ls/actions/workflows/build.yaml/badge.svg)](https://github.com/snyk/snyk-ls/actions/workflows/build.yaml)
[![Release Go binaries](https://github.com/snyk/snyk-ls/actions/workflows/release.yaml/badge.svg)](https://github.com/snyk/snyk-ls/actions/workflows/release.yaml)

Expand All @@ -20,7 +20,7 @@ Right now the LSP supports the following actions:
### Download

The build workflow stores the generated executables, so that they can be
downloaded [here](https://github.com/snyk/snyk-lsp/releases/tag/latest). Just select the release you want the build
downloaded [here](https://github.com/snyk/snyk-ls/releases/tag/latest). Just select the release you want the build
artefacts from and download the zip file attached to it. Currently, executables for Windows, macOS and Linux are
generated.

Expand All @@ -29,7 +29,7 @@ generated.
- Install `go 1.17.5` or higher, set the `GOPATH` and `GOROOT`
- Enter the root directory of this repository
- Execute `go get ./...` to download all dependencies
- Execute `go build && go install` to produce a `snyk-lsp` binary
- Execute `go build && go install` to produce a `snyk-ls` binary
- Download Snyk CLI at :
- macOS: https://static.snyk.io/cli/latest/snyk-macos
- Windows: https://static.snyk.io/cli/latest/snyk-win.exe
Expand Down Expand Up @@ -62,7 +62,7 @@ function:

To automatically add these variables to the environment, Snyk LSP searches for the following files, with the order
determining precedence. If the executable is not called from an already configured environment (e.g. via
`zsh -i -c 'snyk-lsp'`), you can specify a config file with the `-c` command line flag for setting the above mentioned
`zsh -i -c 'snyk-ls'`), you can specify a config file with the `-c` command line flag for setting the above mentioned
variables. Snyk LSP reads the following files in the given precedence and order, not overwriting the already loaded
variables.

Expand Down Expand Up @@ -114,7 +114,7 @@ export DEEPROXY_API_URL

## Configure your client
See [here](https://docs.google.com/document/d/1nUAt4ckza1y1PEE3p4BUsnlmQkE4ltuYURJkYeusYpA/) for details.
You will at least have to update the path to the snyk-lsp executable.
You will at least have to update the path to the snyk-ls executable.

## Code Structure
```
Expand All @@ -139,14 +139,14 @@ go test ./...
The output should look like this (it is running against the Snyk Code API and using the real CLI):

```
? github.com/snyk/snyk-lsp [no test files]
ok github.com/snyk/snyk-lsp/code 24.201s
ok github.com/snyk/snyk-lsp/diagnostics 26.590s
ok github.com/snyk/snyk-lsp/iac 25.780s
? github.com/snyk/snyk-lsp/lsp [no test files]
ok github.com/snyk/snyk-lsp/oss 22.427s
ok github.com/snyk/snyk-lsp/server 48.558s
ok github.com/snyk/snyk-lsp/util 9.562s
? github.com/snyk/snyk-ls [no test files]
ok github.com/snyk/snyk-ls/code 24.201s
ok github.com/snyk/snyk-ls/diagnostics 26.590s
ok github.com/snyk/snyk-ls/iac 25.780s
? github.com/snyk/snyk-ls/lsp [no test files]
ok github.com/snyk/snyk-ls/oss 22.427s
ok github.com/snyk/snyk-ls/server 48.558s
ok github.com/snyk/snyk-ls/util 9.562s
```

## Test Github Action locally
Expand Down
14 changes: 7 additions & 7 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ import (
)

func Test_shouldSetLogLevelViaFlag(t *testing.T) {
args := []string{"snyk-lsp", "-l", "debug"}
args := []string{"snyk-ls", "-l", "debug"}
_, _ = parseFlags(args)
assert.Equal(t, zerolog.DebugLevel, zerolog.GlobalLevel())
}

func Test_shouldSetOutputFormatViaFlag(t *testing.T) {
args := []string{"snyk-lsp", "-o", environment.FormatHtml}
args := []string{"snyk-ls", "-o", environment.FormatHtml}
_, _ = parseFlags(args)
assert.Equal(t, environment.FormatHtml, environment.Format)
}

func Test_shouldShowUsageOnUnknownFlag(t *testing.T) {
args := []string{"snyk-lsp", "-unknown", environment.FormatHtml}
args := []string{"snyk-ls", "-unknown", environment.FormatHtml}

output, err := parseFlags(args)

assert.True(t, strings.Contains(output, "Usage of snyk-lsp"))
assert.True(t, strings.Contains(output, "Usage of snyk-ls"))
assert.NotNil(t, err)
}
func Test_shouldSetLoadConfigFromFlag(t *testing.T) {
Expand All @@ -47,7 +47,7 @@ func Test_shouldSetLoadConfigFromFlag(t *testing.T) {
if err != nil {
assert.Fail(t, "Couldn't write to test file")
}
args := []string{"snyk-lsp", "-c", file.Name()}
args := []string{"snyk-ls", "-c", file.Name()}

_, _ = parseFlags(args)
environment.Load()
Expand All @@ -57,11 +57,11 @@ func Test_shouldSetLoadConfigFromFlag(t *testing.T) {
}

func Test_shouldSetReportErrorsViaFlag(t *testing.T) {
args := []string{"snyk-lsp"}
args := []string{"snyk-ls"}
_, _ = parseFlags(args)
assert.False(t, config.IsErrorReportingEnabled)

args = []string{"snyk-lsp", "-reportErrors"}
args = []string{"snyk-ls", "-reportErrors"}
_, _ = parseFlags(args)
assert.True(t, config.IsErrorReportingEnabled)
}

0 comments on commit 7cfc481

Please sign in to comment.