For example in html file I have
<script src="https://d3js.org/d3.v6.min.js"></script>
and I want to get hints like d3->csv
etc.
In WebStorm it is possible by adding https://d3js.org/d3.v6.min.js
to External Libraries
. Is there a way to do so in VSCode?
It is in a simple HTML+JS file without npm, node etc. like:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://d3js.org/d3.v5.min.js"></script>
</head>
<body>
<script>
d3.SHOW_HINTS
</script>
</body>
</html>
For your d3
use case, all you need to do is:
<script>
tag content from HTML file into a standalone JS file.npm install @types/d3
, like Mike Lischke has already pointed outThe result:
You cannot get the same kind of IntelliSense hint within the <script>
tag inside a HTML file, since the official extension doesn't support it. Please refer to my answer to another question here for more details.