Skip to content

Tide-lv-message shows too few fixes. #466

@phuhl

Description

@phuhl

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.
    • ish. It reports the error, just not the fix.
  • I am positive the problem does not belong to typescript-mode or tsserver.

Relevant Version Numbers

  • Tide: 20230428.1846
  • TypeScript: 5.0.2
  • Emacs: GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.17.8) of 2023-04-26

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

Steps to Reproduce the Bug

I have this code:

export const MainAppContainer = () => {
  useEffect(() => {}, []);
  return null
};

useEffect is not imported. Tide correctly identifies the issue and produces the correct warning/error. I run tide-fix. Tide only displays this:

image

I checked TS-Server and debugged into tide. TS-server reports two fixes. This patch within tide.el shows that this is clearly a display issue, probably caused by tide-lv-message:

(defun tide-popup-select-item (prompt list)
  (let ((hints (-map-indexed
                (lambda (i item)
                  (concat (propertize (char-to-string (nth i tide-alphabets)) 'face 'tide-choice-face)
                          "  "
                          item))
                list)))
+   (message (mapconcat 'identity hints "\n"))
    (unwind-protect
        (progn
          (tide-lv-message (mapconcat 'identity hints "\n"))
          (let ((selected (read-char-choice prompt (-take (length list) tide-alphabets))))
            (nth (-find-index (lambda (char) (eql selected char)) tide-alphabets) list)))
        (tide-lv-delete-window))))

The modified version prints out this:

a  Add missing function declaration ’useEffect’
s  Update import from "react"

Also, using the "s"-key applies the fix.

Expected Behavior

All fixes should be shown by tide-lv

Actual Behavior

Only n-1 (?) fixes are shown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions