How do I disable code formatting for one line of inline JS (inside a HTML file) in…
- User
How do I disable code formatting for one line of inline JS (inside a HTML file) in VSCode? I'm using the standard HTML extension, not "prettier" and not "typescript".
Assistant
To disable code formatting for one line of inline JS (inside an HTML file) in Visual Studio Code (VSCode), you can follow these steps:
- Open your HTML file in VSCode.
- Navigate to the line of inline JS you want to disable formatting for.
- Add a comment with
// prettier-ignoreat the end of the line. For example:
<script> // Some inline JS code var x = 10; // prettier-ignore </script>This will prevent the inline JS code from being formatted by Prettier, which is the default formatter for JavaScript in VSCode. If you are using a different formatter, you may need to adjust the comment syntax accordingly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.