Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Update esbuild and make the watcher work without triggering a warning…
Browse files Browse the repository at this point in the history
… prompt.

- onCommand:extension.insertColonOrSemiColon is no longer needed to be displayed as VS Code now knows which commands we have.
  • Loading branch information
jasonwilliams committed Dec 13, 2023
1 parent 8c7a6fb commit 52e29eb
Show file tree
Hide file tree
Showing 8 changed files with 659 additions and 633 deletions.
8 changes: 8 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
"isDefault": true
},
"isBackground": true,
"problemMatcher": {
"base": "$tsc-watch",
"background": {
"activeOnStart": true,
"beginsPattern": "building...",
"endsPattern": "build finished"
}
},
"label": "npm: watch",
"detail": "ESBuild watch mode"
}
Expand Down
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ src/**
.github/**
.nvmrc
.editorConfig
build.js
build.mjs
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ You can't run the typescript-styled-plugin directly, instead you need to load a
- Make sure `typescript-styled-plugin` is yarn|npm linked into `vscode-styled-components` (see image above)
- uncomment the plugin section in [tsconfig](https://github.com/styled-components/vscode-styled-components/blob/master/tsconfig.json#L18), make sure the path points to your local checkout of typescript styled plugin
- In `vscode-styled-components/.vscode/launch.json`, `"TSS_DEBUG": "9229"` should be set (or `"TSS_REMOTE_DEBUG": "9229"` if using WSL). This allows the debugger to communicate with the typescript-styled-plugin. These may already be set.
- [Debug Tab] Click `Launch extension` (you may get a prompt, select "debug anyway")
- [Debug Tab] Click `Launch extension`
- Once the new window is up and running go back to the host VSCode instance and on the debug tab Click `Debug Styled Plugin` - This will both build and start the debugger on the typescript-styled-plugin project.

You should now be able to use styled-components in the guest window and set breakpoints on the both the plugin and extension in the main window.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ If however you believe this property is standard and thus missing you can raise
### Intellisense is not working!

#### It hasn't worked since updating to v1.7.8!

This is due to a clash between TypeScript 5.0.0 and this extension. When VSCode released March 2023 that had TypeScript 5.X set by default which 1.7.8 supports but lower versions don't.
So, if you're not getting intellisense its most likely because you've updated the extension but haven't updated your version of TypeScript yet. The quick option is to downgrade to v1.7.5, the long term option is to migrate to TypeScript 5.X
See: https://github.com/styled-components/vscode-styled-components/issues/387
Expand Down
23 changes: 0 additions & 23 deletions build.js

This file was deleted.

40 changes: 40 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import esbuild from "esbuild";

const production = process.argv[2] === "--production";
const watch = process.argv[2] === "--watch";
const context = await esbuild
.context({
entryPoints: ["./src/extension.ts"],
bundle: true,
outdir: "dist",
external: ["vscode"],
format: "cjs",
sourcemap: !production,
minify: production,
platform: "node",
target: "ES2022",
plugins: [
{
name: "watch",
setup(build) {
build.onEnd(() => {
if (watch) console.log("build finished");
});
build.onStart(() => {
if (watch) console.log("building...");
});
},
},
],
})
.catch((e) => {
console.error(e);
process.exit(1);
});

if (watch) {
await context.watch();
} else {
context.rebuild();
context.dispose();
}
Loading

0 comments on commit 52e29eb

Please sign in to comment.