Skip to content

Commit 8355f70

Browse files
committed
chore: provide a more useful hint if scripts aren't loaded
Fixes microsoft/vscode#109528
1 parent fed09a0 commit 8355f70

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/diagnosticTool/breakpointHelper.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,21 @@ const NoMatchingSourceHelper: FunctionComponent<{ basename: string }> = ({ basen
310310
How did you expect this file to be loaded? (If you have a compilation step, you should pick
311311
'sourcemap')
312312
<NoMatchingDecisionButtons onChange={setHint} value={hint} />
313-
{hint === NoMatchingSourceHint.Direct && (
314-
<p>
315-
It looks like your program didn't load the file this run. Make sure it's loaded by your
316-
program.
317-
</p>
318-
)}
313+
{hint === NoMatchingSourceHint.Direct &&
314+
(isBrowserType(dump) ? (
315+
<p>
316+
It looks like your webpage didn't load this script; breakpoints won't be bound until
317+
the file they're set in is loaded. Make sure your script is imported from the right
318+
location using a <code>{'<script>'}</code> tag.
319+
</p>
320+
) : (
321+
<p>
322+
It looks like your program didn't load this script; breakpoints won't be bound until
323+
the file they're set in is loaded. Make sure your script is imported with a{' '}
324+
<code>require()</code> or <code>import</code> statement, such as{' '}
325+
<code>require('./{basename}')</code>.
326+
</p>
327+
))}
319328
{hint === NoMatchingSourceHint.SourceMap && (
320329
<p>
321330
Here's some hints that might help you:

0 commit comments

Comments
 (0)