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

LSP can't autocomplete for provider "google" #49

Closed
GuillaumeDesforges opened this issue May 1, 2023 · 8 comments
Closed

LSP can't autocomplete for provider "google" #49

GuillaumeDesforges opened this issue May 1, 2023 · 8 comments

Comments

@GuillaumeDesforges
Copy link

GuillaumeDesforges commented May 1, 2023

Using the template provided with the TF provider github has autocomplete working.
But with TF provider google autocomplete does not work.

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    nickel.url = "github:tweag/nickel";
    tf-ncl.url = "github:tweag/tf-ncl";
    tf-ncl.inputs.nickel.follows = "nickel";
    utils.url = "github:numtide/flake-utils";
  };

  nixConfig = {
    extra-substituters = [ "https://tweag-nickel.cachix.org" ];
    extra-trusted-public-keys = [ "tweag-nickel.cachix.org-1:GIthuiK4LRgnW64ALYEoioVUQBWs0jexyoYVeLDBwRA=" ];
  };

  outputs = inputs: inputs.utils.lib.eachDefaultSystem (system:
    {
      devShell = inputs.tf-ncl.lib.${system}.mkDevShell {
        providers = p: {
          inherit (p) github;
        };
      };
    });
}

image

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    nickel.url = "github:tweag/nickel";
    tf-ncl.url = "github:tweag/tf-ncl";
    tf-ncl.inputs.nickel.follows = "nickel";
    utils.url = "github:numtide/flake-utils";
  };

  nixConfig = {
    extra-substituters = [ "https://tweag-nickel.cachix.org" ];
    extra-trusted-public-keys = [ "tweag-nickel.cachix.org-1:GIthuiK4LRgnW64ALYEoioVUQBWs0jexyoYVeLDBwRA=" ];
  };

  outputs = inputs: inputs.utils.lib.eachDefaultSystem (system:
    {
      devShell = inputs.tf-ncl.lib.${system}.mkDevShell {
        providers = p: {
          inherit (p) google;
        };
      };
    });
}

image

Note: don't forget to run link-schema in between

@vkleen
Copy link
Contributor

vkleen commented May 2, 2023

Thanks for the detailed report! I'm fairly confident that the issue is the language server just taking too long to process the completion request for the google provider contract, on account of its size. The best solution to that would be a project that I was contemplating anyway, namely to try modularizing the generated contracts. It might be feasible to replace the current monolithic contract file with one that essentially just lists all the available resources or data source with import statements for the actualy contract for each. That would at least push the timeout limit further down the road.

@GuillaumeDesforges
Copy link
Author

@vkleen thanks for the fast reply

the issue is the language server just taking too long to process the completion request for the google provider contract, on account of its size

I came to the same conclusions as well. For the record, I use coc.nvim.

modularizing the generated contracts

Sounds very interesting. 🙂

@sedlund
Copy link

sedlund commented Mar 19, 2024

tf-ncl-2024-03-19_16-48-11.webm

i tried this example with the github provider and found that the nls language server process climbed up to 5gb of used ram while trying different completions and it oom'd my VM i was running it on. is the ram usage expected? if so how much ram should i plan to have to work with this?

@yannham
Copy link
Member

yannham commented Mar 20, 2024

Hi @sedlund, thanks for the report. 5GB isn't reasonable, no. Could you tell what version of nls did you install? Because of a dumb overlook, nls doesn't have a --version argument available, but if you installed it with a nickel binary, then nickel --version should do the trick.

@sedlund
Copy link

sedlund commented Mar 21, 2024

didnt want to hijack this - opened #66

@yannham
Copy link
Member

yannham commented Dec 26, 2024

@jneem I believe this has been fixed by tweag/nickel#2073?

@jneem
Copy link
Member

jneem commented Dec 26, 2024

I believe so, yes.

@yannham
Copy link
Member

yannham commented Dec 26, 2024

Great, let's close - feel free to ask to re-open if this isn't the case in your experience.

@yannham yannham closed this as completed Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants