Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 Rome VSCode extension crashes for closure function passing itself as an argument #3697

Closed
1 task done
LunaTK opened this issue Nov 13, 2022 · 3 comments · Fixed by #3777
Closed
1 task done
Assignees
Labels
A-Linter Area: linter S-Bug: confirmed Status: report has been confirmed as a valid bug

Comments

@LunaTK
Copy link

LunaTK commented Nov 13, 2022

Environment information

yarn run v1.22.11
$ /Users/lunatk/Devsisters/rome-crash/node_modules/.bin/rome rage
CLI:
  Version:              10.0.1
  Color support:        true

Platform:
  CPU Architecture:     aarch64
  OS:                   macos

Environment:
  ROME_LOG_DIR:         unset
  NO_COLOR:             unset
  TERM:                 "xterm-256color"

Rome Configuration:
  Status:               loaded
  Formatter disabled:   false
  Linter disabled:      false

Workspace:
  Open Documents:       0

Discovering running Rome servers...

Running Rome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The client isn't connected to any server but rage discovered this running Rome server.

Server:
  Version:              10.0.1
  Name:                 rome_lsp
  CPU Architecture:     aarch64
  OS:                   macos

Workspace:
  Open Documents:       0

Rome Server Log:

! Please review the content of the log file before sharing it publicly as it may contain sensitive information:
  * Path names that may reveal your name, a project name, or the name of your employer.
  * Source code

... trimmed

  • Device : MacBook Air (M1, 2020)

    • OS : macOS Monterey 12.4
    • Memory : 8GB
  • Visual Studio Code

    Version: 1.72.2 (Universal)
    Commit: d045a5eda657f4d7b676dedbfa7aab8207f8a075
    Date: 2022-10-12T22:16:30.254Z (1 mo ago)
    Electron: 19.0.17
    Chromium: 102.0.5005.167
    Node.js: 16.14.2
    V8: 10.2.154.15-electron.0
    OS: Darwin arm64 21.5.0
    Sandboxed: No
    
  • Rome VSCode Extension

    • Identifier: "rome.rome"
    • Version: v0.18.1 (Preview)

What happened?

Reproduction repo : https://github.com/LunaTK/rome-crash-reproduction

The following TypeScript code makes Rome VSCode extension crash.

type Func = (callback: Func) => void;

const romeKiller = () => {
  const fn = (callback: Func) => {
    callback(fn);
  };
};

image

If fn stays in the top level, it doesn't kill Rome.

const fn = (callback: Func) => {
  callback(fn); // no problem
};

Expected result

Rome VSCode extension should not die.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@LunaTK LunaTK added the S-To triage Status: user report of a possible bug that needs to be triaged label Nov 13, 2022
@MichaReiser
Copy link
Contributor

Interesting. @xunilrj could this be related to the semantic model or cfg?

@leops
Copy link
Contributor

leops commented Nov 14, 2022

It looks like this is related to the inlineVariable refactor: when the cursor is placed over the fn token we try to emit a code action to inline the variable, however the resulting mutation is obviously invalid since it requires inserting a node into itself so committing the mutation panics and crashes the server

@leops leops added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Linter Area: linter and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Nov 14, 2022
@xunilrj
Copy link
Contributor

xunilrj commented Nov 14, 2022

I will assign this to myself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants