A vscode extension to insert 'use client' at line 1 with a easyy shortcut for NextJS client components.
MIT License
This VSCode extension helps you easily insert the 'use client'
directive at the top of your Next.js client components. The extension provides a command to insert 'use client'
at line 1 or at the current cursor position based on your preference.
ctrl/cmd + p
(or rebind to ctrl + ctrl
like a real gigachad)> extension install from vsix
or > vsix
will do. > Enternextjs-use-client-inserter-helper-1.0.0.vsix
and install that and g2g.'use client'
at line 1 of your file.Clone the repository:
git clone https://github.com/remcostoeten/vscode-extension-insert-use-client-for-nextjs-with-ease.git
Navigate to the project directory:
cd vscode-extension-insert-use-client-for-nextjs-with-ease
Install the dependencies:
npm install
Build the extension:
npm run build
For this step the vsce cli is needed. Google for this, easy install. Or just directly install the .vsix
from the repo.
Open the project in VSCode:
vsce package
```
Refer to TLDR section
You can customize the behavior of this extension by adding the following settings to your settings.json
in VSCode:
{
"useClientInsertion.insertOnFirstLine": true,
"useClientInsertion.wordToInsert": "\"use client\";"
}