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

Trim trailing slash from rootUri on initialize #203

Closed
radeksimko opened this issue Jul 3, 2020 · 2 comments
Closed

Trim trailing slash from rootUri on initialize #203

radeksimko opened this issue Jul 3, 2020 · 2 comments
Assignees
Labels
bug Something isn't working editor/intellij https://www.jetbrains.com/idea/
Milestone

Comments

@radeksimko
Copy link
Member

radeksimko commented Jul 3, 2020

Server Version

v0.4.0

Client Version

IntelliJ LSP Support 1.6.1

Terraform Configuration Files

provider "aws" {

}

Log Output

The IntelliJ extension seems to be sending trailing slash with the rootUri in the initalize request:

2020/07/03 10:32:26 server.go:223: Checking request for "initialize": {"processId":null,"rootUri":"file:///private/var/workspace/tf-test/github/","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true},"didChangeConfiguration":{},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{},"executeCommand":{},"workspaceFolders":false,"configuration":true},"textDocument":{"synchronization":{"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"completionItem":{"snippetSupport":true}},"hover":{},"signatureHelp":{},"references":{},"documentHighlight":{},"formatting":{},"rangeFormatting":{},"onTypeFormatting":{},"definition":{},"codeAction":{},"rename":{"prepareSupport":true,"dynamicRegistration":false},"semanticHighlightingCapabilities":{"semanticHighlighting":false}}}}

which then makes the server believe that /private/var/workspace/tf-test/github/ is not the same as /private/var/workspace/tf-test/github.

Expected Behavior

Root module to be found

Actual Behavior

Screenshot 2020-07-03 at 10 38 12

Arguably that message shouldn't be presented like this since it's a warning, not an error, but that's something to fix on the client side.

Steps to Reproduce

  1. terraform init the folder with the above config
  2. Open a folder with the above config
  3. Open the above file from that folder
@radeksimko radeksimko added bug Something isn't working editor/intellij https://www.jetbrains.com/idea/ labels Jul 3, 2020
@radeksimko radeksimko added this to the v0.4.2 milestone Jul 3, 2020
@radeksimko
Copy link
Member Author

This seems to be already happening

// Dir URIs are usually without trailing separator already
// but we do sanity check anyway, so we deal with the same URI
// regardless of language client differences
uri := strings.TrimSuffix(string(dirUri), "/")

also I'm unsure why, but the bug is not reproducible after the refactoring in #219 so I'm assuming #219 solves it.

@radeksimko radeksimko self-assigned this Jul 9, 2020
@radeksimko radeksimko modified the milestones: v0.4.2, v0.5.0 Jul 10, 2020
@ghost
Copy link

ghost commented Aug 8, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Aug 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working editor/intellij https://www.jetbrains.com/idea/
Projects
None yet
Development

No branches or pull requests

1 participant