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

Use external modules #13

Merged
merged 4 commits into from
Sep 17, 2021
Merged

Use external modules #13

merged 4 commits into from
Sep 17, 2021

Conversation

haruyama
Copy link
Sponsor Contributor

I am not sure what the policy is on using external modules and entryName handling, so I make a Draft PR.

Use the GatherCandidatesArguments from ddc.vim 2e4bf03

This resolves TS2416 [ERROR]: Property 'gatherCandidates' in type 'Source' is not assignable to the same property in base type 'BaseSource'. error.

% deno run denops/ddc-sources/nvimlsp.ts
Check file:///home/haruyama/work/Vim/ddc-nvim-lsp/denops/ddc-sources/nvimlsp.ts
error: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'. 'Deno.utime' is an unstable API. Did you forget to run with the '--unstable' flag?
    await Deno.utime(dest, statInfo.atime, statInfo.mtime);
               ~~~~~
    at https://deno.land/std@0.104.0/fs/copy.ts:96:16

(snip)


TS2416 [ERROR]: Property 'gatherCandidates' in type 'Source' is not assignable to the same property in base type 'BaseSource'.
  Type '(args: { denops: Denops; context: Context; sourceParams: Record<string, Params>; completeStr: string; }) => Promise<Candidate[]>' is not assignable to type '({}: GatherCandidatesArguments) => Promise<Candidate[]>'.
    Types of parameters 'args' and '__0' are incompatible.
      Type 'GatherCandidatesArguments' is not assignable to type '{ denops: Denops; context: Context; sourceParams: Record<string, Params>; completeStr: string; }'.
        Types of property 'sourceParams' are incompatible.
          Type 'Record<string, unknown>' is not assignable to type 'Record<string, Params>'.
            Index signatures are incompatible.
              Type 'unknown' is not assignable to type 'Params'.
  async gatherCandidates(args: {
        ~~~~~~~~~~~~~~~~
    at file:///home/haruyama/work/Vim/ddc-nvim-lsp/denops/ddc-sources/nvimlsp.ts:57:9

Found 7 errors.

Use the CompletionItem from vscode_languageserver_types 98372d6

This resolves some (no-explicit-any) problems from deno lint.

I did not know how to handle entryName, and I did not find entryName in Language Server Protocol Specification.
If entryName handling is needed, we cannot use vscode_languageserver_types as is.

Use the equal from equal for checking the objects are equal c2d73fd

From https://basarat.gitbook.io/typescript/recap/equality#structural-equality

If you want to compare two objects for structural equality ==/=== are not sufficient. e.g.

textEdit.range.{start,end} are Position,
so I think we should not use ==/===.

@Shougo
Copy link
Owner

Shougo commented Sep 17, 2021

I am not sure what the policy is on using external modules and entryName handling, so I make a Draft PR.

I think it seems good.

@haruyama haruyama marked this pull request as ready for review September 17, 2021 02:04
@Shougo
Copy link
Owner

Shougo commented Sep 17, 2021

I will merge it later.

@Shougo Shougo merged commit f69ceeb into Shougo:main Sep 17, 2021
@Shougo
Copy link
Owner

Shougo commented Sep 17, 2021

Merged.

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

Successfully merging this pull request may close these issues.

None yet

2 participants