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

Show full type definition of thing under cursor without truncation #399

Closed
6 of 7 tasks
sandric opened this issue Oct 2, 2020 · 1 comment
Closed
6 of 7 tasks

Comments

@sandric
Copy link

sandric commented Oct 2, 2020

When submitting issues to this project, please include the following information.

Checklist

  • I have searched both open and closed issues and cannot find a duplicate.
  • I can reproduce the problem with the latest version of the relevant packages.
  • The problem still occurs after I issued M-x tide-restart-server in the buffer where I had the problem.
  • I verified that the version and the configuration file path reported by M-x tide-verify-setup are correct.
  • If tide is reporting an error or warning I think should not be reported, I can run tsc (and tslint, if applicable) without the error or warning I'm seeing in tide.
  • If tide is not reporting an error or warning I think should be reported, tsc (or tslint, if applicable) reports the error or warning I was expecting to see.
  • I am positive the problem does not belong to typescript-mode or tsserver.

Relevant Version Numbers

  • Tide: 20200823.524
  • TypeScript: 3.8.2
  • Emacs: 27.1

(The list above is minimal. Make sure to include any other version numbers relevant to your report.)

Steps to Reproduce the Bug

Open typescript file and hover cursor over type definition with arguably big number of lines. Then call tide-documentation-at-point.

Expected Behavior

I expect to see full type definition.

Actual Behavior

The output is truncated if type is long - I see just a beginning, followed by ... <n lines> more ...:

const context: {
    formikContext: FormikContextType<Id<Partial<Pick<object & {
        name: string;
        values: object;
    }, "name" | "values">> & Pick<object & {
        name: string;
        values: object;
    }, never>>>;
    ... 18 more ...;
    onSubmit: () => void;
}

image

I investigated a bit tide-documentation-at-point and as far as I understand - this behaviour comes from tide-command:quickinfo - I tried to change this to my custom function using quickinfo-full to take it out of equation, but get the same truncation when calling it:

(defun sandric/tide-full-documentation-at-point ()
  "Show documentation of the symbol at point."
  (interactive)
  (tide-command:quickinfo-full
    (tide-on-response-success-callback response
      (-if-let (body (tide-construct-documentation (plist-get response :body)))
          (tide-display-help-buffer "documentation" body)
        (message "No documentation available.")))))

I can understand that is intentional though so that output can be truncated in minibuffer, but I would appreciate if someone points me to how to define my own function to show full type.

@ananthakumaran
Copy link
Owner

tide doesn't truncate the output, it's done at tsserver microsoft/TypeScript#26238. Make sure to set noErrorTruncation to true, there is still a hard limit as explained in the microsoft/TypeScript#26238 (comment)

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

2 participants