-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
File auto-detection doesn't work for inline sourcemaps #168013
File auto-detection doesn't work for inline sourcemaps #168013
Comments
I think this is just language detection kicking in. The DA doesn't transmit any information about the language of a source, and there's no field in DAP to do so. |
@connor4312 did you see this? Also, since there's a Maybe we need @bpasero. @connor4312 how do you open this file? |
If it matters, here's the file itself: https://github.com/jridgewell/sourcemap-codec/blob/main/src/sourcemap-codec.ts The first few lines are obviously TS (or, I guess, Flow): export type SourceMapSegment =
| [number]
| [number, number, number, number]
| [number, number, number, number, number];
export type SourceMapLine = SourceMapSegment[];
export type SourceMapMappings = SourceMapLine[]; One thing that's interesting: in this case, the sourcemap of I don't think this changes the behavior though. I've seen the same behavior in other packages that do include sources content inside the sourcemap file but don't include source files in the package. For example, I reproed the problem while testing a PR in the @js-temporal/polyfill repo that I help to maintain. The specific commit which exhibited the problem was this one: js-temporal/temporal-polyfill@4a6348b. Later commits in this PR won't repro the problem, because we added the source files to Let me know if I can be helpful to repro this for you. |
ah, missed that. I don't see where we set the mode for debug resources. @roblourens do you know? |
Here
|
js-debug has just been hardcoding |
Fixes microsoft/vscode#168013 We don't know if a source type is actually JavaScript. Just let the editor guess instead of reimplementing mimetype detection ourselves
Fixes microsoft/vscode#168013 We don't know if a source type is actually JavaScript. Just let the editor guess instead of reimplementing mimetype detection ourselves
What happened to the file extension? |
Ah, right. We do need to have the mimtype for those.
Those just come in as a source with a URL like |
Type: Bug
When the VS Code JS debugger loads a source-mapped file, language auto-detection only works if the source file shown in the IDE debugger is loaded from a source file in
node_modules
. However, if the source file shown in the IDE is loaded via code in an inline sourcemap, then the file will be detected as JS, even if the filename in the sourcemap has a.ts
extension and would be detected as TS code if pasted into an empty file.Repro:
npx create-react-app sourcemap-debug --template typescript
cd sourcemap-debug
npm start
node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts
to something else, e.g.node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts.hide
. This will force VSCode to load the source from this package's inline sourcemap instead.Expected: Library's source file, like it was before, is detected as TS
Actual: Library's source file
sourcemap_codec.ts
is detected as JS, and there's a lot of errors shown in the Problems pane because TS code isn't valid JS.You can easily validate that this isn't a language auto-detector problem alone, because when you Select All on the source file and copy that code into a blank file, then it's correctly detected as TypeScript.
VS Code version: Code 1.73.1 (Universal) (6261075, 2022-11-09T02:08:38.961Z)
OS version: Darwin arm64 22.1.0
Modes:
Sandboxed: No
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Extensions (23)
A/B Experiments
The text was updated successfully, but these errors were encountered: