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

Relative path does not in Typescript/Javascript cells in vscode Notebooks. #196172

Open
mmis1000 opened this issue Oct 21, 2023 · 0 comments
Open
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities notebook
Milestone

Comments

@mmis1000
Copy link

mmis1000 commented Oct 21, 2023

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.83.1
  • OS Version: windows 10

Steps to Reproduce:

  1. install https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook or https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter-renderers
  2. open a workspace
  3. create typescript file 'a.ts' with some exports in the workspace, for example export const a = 1
  4. create a notebook with one of the extensions and save it next to the typescript file.
  5. add a cell with language type 'typescript' or 'javascript'.
  6. import the exported symbol from step 3, for example: import {a} from './a.ts'
  7. right click on file name and click go to definition

Expected:

  1. The symbol imported normally.
  2. go to definition lead you to the file next to it

Actually:

  1. The import has a red underline with TS(2307) Cannot find module
  2. go to definition lead you to a error page that has a nonsense path like this
    圖片

Note:

It seems this is caused by the way typescript language extension handles virtual paths.
The typescript language extension put all virtual path under ^/{protocol}/{authority}/{file-path}#{cell-id}
Which end up being treated as {workspace root}/^/{protocol}/{authority}/{file-path}#{cell-id} by the language server
And thus broke all relative paths.

I made a experiment about appending the cell id and authority to file name instead, and it seems fix this issue.

mmis1000@bb9910b

Related issue: DonJayamanne/typescript-notebook#79

@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities notebook labels Nov 15, 2023
@mjbvz mjbvz added this to the Backlog milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities notebook
Projects
None yet
Development

No branches or pull requests

2 participants