Skip to content

Commit

Permalink
fix: don't hardcode generated source types as javascript
Browse files Browse the repository at this point in the history
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
  • Loading branch information
connor4312 committed Jan 5, 2023
1 parent 1d60d6e commit e2907be
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
- fix: reduce number of ports used by debugger ([vscode#169182](https://github.com/microsoft/vscode/issues/169182))
- fix: support launching chrome dev/beta as default fallbacks ([#1489](https://github.com/microsoft/vscode-js-debug/issues/1489))
- fix: show memory refrence button for top-level watch expressions ([vscode#164124](https://github.com/microsoft/vscode/issues/164124))
- fix: don't hardcode generated source types as javascript ([vscode#168013](https://github.com/microsoft/vscode/issues/168013))
- refactor: improve breakpoint scanning speed 2-3x ([#1498](https://github.com/microsoft/vscode-js-debug/issues/1498))

## v1.74 (November 2022)
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/debugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export class DebugAdapter implements IDisposable {
);
}

return { content, mimeType: source.mimeType() };
return { content };
}

async _onThreads(): Promise<Dap.ThreadsResult | Dap.Error> {
Expand Down
4 changes: 0 additions & 4 deletions src/adapter/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ export class Source {
return content;
}

mimeType(): string {
return 'text/javascript';
}

/**
* Pretty-prints the source. Generates a beauitified source map if possible
* and it hasn't already been done, and returns the created map and created
Expand Down
6 changes: 0 additions & 6 deletions src/test/sources/sources-basic-source-map.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Source event for
sourceReference : <number>
}
}
text/javascript
---------
import * as m1 from './module1';
import * as m2 from './module2';

Expand All @@ -32,8 +30,6 @@ Source event for
sourceReference : <number>
}
}
text/javascript
---------
export const kModule1 = 1;
export function foo() {
debugger;
Expand All @@ -56,8 +52,6 @@ Source event for
sourceReference : <number>
}
}
text/javascript
---------
export const kModule2 = 2;
export function bar(callback) {
callback();
Expand Down
10 changes: 0 additions & 10 deletions src/test/sources/sources-basic-sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Source event for inline
sourceReference : <number>
}
}
text/javascript
---------


console.log('inline script');
Expand All @@ -25,8 +23,6 @@ Source event for empty.js
sourceReference : <number>
}
}
text/javascript
---------
"111111111111111111111111111111111111111111111111111"

---------
Expand All @@ -41,8 +37,6 @@ Source event for does not exist
sourceReference : <number>
}
}
text/javascript
---------
17
//# sourceURL=http://localhost:8001/doesnotexist.js
---------
Expand All @@ -56,8 +50,6 @@ Source event for dir/helloworld
sourceReference : <number>
}
}
text/javascript
---------
console.log('Hello, world!');

---------
Expand All @@ -72,8 +64,6 @@ Source event for eval
sourceReference : <number>
}
}
text/javascript
---------
42

---------
Expand Down
4 changes: 0 additions & 4 deletions src/test/sources/sources-updated-content.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Source event for test.js
sourceReference : <number>
}
}
text/javascript
---------
content1//# sourceURL=test.js
---------

Expand All @@ -22,8 +20,6 @@ Source event for test.js updated
sourceReference : <number>
}
}
text/javascript
---------
content2//# sourceURL=test.js
---------

Expand Down
8 changes: 0 additions & 8 deletions src/test/sources/sources-url-and-hash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Source event for foo.js
sourceReference : <number>
}
}
text/javascript
---------
a
//# sourceURL=foo.js
---------
Expand All @@ -23,8 +21,6 @@ Source event for foo.js
sourceReference : <number>
}
}
text/javascript
---------
b
//# sourceURL=foo.js
---------
Expand All @@ -38,8 +34,6 @@ Source event for empty.js
sourceReference : <number>
}
}
text/javascript
---------
"111111111111111111111111111111111111111111111111111"

---------
Expand All @@ -53,8 +47,6 @@ Source event for empty2.js
sourceReference : <number>
}
}
text/javascript
---------

---------

Expand Down
2 changes: 0 additions & 2 deletions src/test/sources/sourcesTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ describe('sources', () => {
sourceReference: event.source.sourceReference,
},
});
p.log(`${content.mimeType}`);
p.log('---------');
p.log(content.content);
p.log('---------');
}
Expand Down

0 comments on commit e2907be

Please sign in to comment.