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

[Feature Request] Auto-import on Completion respecting the prefixed in tsconfig.json #434

Closed
nyngwang opened this issue Oct 29, 2021 · 7 comments

Comments

@nyngwang
Copy link

nyngwang commented Oct 29, 2021

Yes, don't panic, I did read your words on reading/following the template or so. This is not a bug report, but a feature request. It just takes a little time to read since I will provide some images:

  1. I'm using your plugin to Auto-Import on completion. It seems great but when I remove-then-auto-import-back to enjoy this feature...

  2. So yep you got the point. The completion system doesn't respect the tsconfig.json:

I think auto-import should be accurate to be useful. So many you might consider adding this feature.

Sincerely,
Ning.
2021/10/29

@hrsh7th
Copy link
Owner

hrsh7th commented Oct 29, 2021

I think it is aneovim/nvim-lspconfig and typescript-language-server area.

@hrsh7th
Copy link
Owner

hrsh7th commented Oct 29, 2021

The latest typescript-language-server has preferences configuration https://github.com/typescript-language-server/typescript-language-server#initializationoptions

(Sorry. I don't know how to realize your expectation with the configuration...

@nyngwang
Copy link
Author

nyngwang commented Oct 29, 2021

OK, I will take a look since I'm new to LSP-things.

@hrsh7th
Copy link
Owner

hrsh7th commented Oct 29, 2021

No problem.

Hm... I can't get the different behavior with changing preferences option...

@nyngwang
Copy link
Author

nyngwang commented Feb 6, 2022

@hrsh7th: may I ask you that is it possible to auto-import-on-completion this kind of line: import Another from ./Another, where ./Another is another component under the same directory? Currently, if I directly type <Anoth|(| the cursor) then the completion-manual will not show the component ./Another in the list. What I expect is that the line import Another from ./Another will be added automatically on selection-confirm.

@hrsh7th
Copy link
Owner

hrsh7th commented May 7, 2023

At least, this feature request is out of scope of nvim-cmp.
It must be solved on typescript-language-server or vtsls.

@hrsh7th hrsh7th closed this as completed May 7, 2023
@ubugnu
Copy link

ubugnu commented Jul 8, 2023

here is what I used:

lspconfig.tsserver.setup {
  init_options = {
    preferences = {
      importModuleSpecifierPreference = "non-relative",
    },
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants