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

autocomplete does not work correctly for the resource type #373

Closed
andrey-dubnik opened this issue Jun 11, 2020 · 8 comments · Fixed by hashicorp/terraform-ls#300
Closed
Assignees
Labels
bug Something isn't working upstream/vscode

Comments

@andrey-dubnik
Copy link

Hi,

Having small issues with autocomplete while using the resource block

resource "" "name" {

}

Typing anything inside the "" triggers no autocomplete where removing the "" actually triggers the correct behaviour although resource is not quoted

resource helm_release "name" {

}

Expected behaviour is to autocomplete inside the quotes of the resource ""

@andrey-dubnik
Copy link
Author

It works correctly for the scenario with resource inside the quotes when autocomplete is initiated manually e.g. [Cmd] + [Esc]

@rothman857
Copy link

rothman857 commented Jun 11, 2020

I am seeing the same behavior, except that it also does not work correctly when manually initiating autocomplete on Windows10 ( [ctrl] + [space] ).

Running v2.0.1 on Windows 10.
VScode 1.46.0

@paultyng
Copy link
Contributor

This seems to be a setting/limitation upstream in VS Code: microsoft/vscode#23962 (comment)

We'll need to investigate what we can do to override it, until then you will need to manually initiate completion inside quotes.

@byron70
Copy link

byron70 commented Aug 1, 2020

I was able to get this working when manually initiating inside the resource type quotes by adding this to my user settings. I have a feeling adding "editor.quickSugggestions": {"strings": true} globally would probably mess with some other languages.

    "[terraform]": {
        "editor.tabSize": 2,
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "hashicorp.terraform",
        "editor.quickSuggestions": {
            "other": true,
            "comments": false,
            "strings": true
        }
    }

@aeschright
Copy link
Contributor

Thanks @byron70 – the language-specific config is the best option for people who want to have this option right now.

@paultyng paultyng self-assigned this Aug 11, 2020
@tatsuo48
Copy link

tatsuo48 commented Aug 13, 2020

In my case, adding the following improved the situation.

"editor.suggest.snippetsPreventQuickSuggestions": false

After inserting the snippet of the resource, it will be autocomplete without moving the cursor to another line once

@paultyng
Copy link
Contributor

Potentially also related to this: microsoft/language-server-protocol#565

We can solve this in a couple ways I think, in order of preference:

  1. use the completion item command to trigger an additional completion for the item
  2. suggestion the full block instead of the initial keyword (ie. resource "aws_...." as the completion item)
  3. pass resource names as snippet enums

3 is probably undesirable as you don't get the rich hinting with descriptions, etc. 2 is probably the most "correct" implementation possibly, but 1 is maybe the past of least resistance in the near term.

Here is an implementation of 1 from the Dart extension: https://github.com/Dart-Code/Dart-Code/blob/7df6509870d51cc99a90cf220715f4f97c681bbf/src/providers/dart_completion_item_provider.ts#L197-202

@ghost
Copy link

ghost commented Dec 16, 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 as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working upstream/vscode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants