pushqrdx / vscode-inline-html

🎨 Adding Syntax Highlighting, Emmet, IntelliSense support for ES6 Template Strings in Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=pushqrdx.inline-html
GNU General Public License v3.0
58 stars 15 forks source link

Feature Request: tsx & jsx support. #34

Open tylermmorton opened 2 years ago

tylermmorton commented 2 years ago

Hi, thanks for the awesome plugin!

Would it be possible to add support for other types of syntax highlighters? I'm building a code mod tool and it would be great to have this IDE feature when writing test tables that contain tsx syntax as inputs:

const codeFixerTestTable = [{
    input: /* tsx */ `
        export const Test1 = ({ id }) => {
            return <div id={id}>foo</div>;
        };
    `,
    expect: /* tsx */ `
        export const Test1 = ({ id }) => {
            return <div id={id}>
                <wrapper>foo</wrapper>
            </div>;
        };        
    `
}]

Perhaps I'm oversimplifying things but wouldn't it be possible to use any built-in language mode in VS Code if the file extension was specified in the comment prefix? I'd be happy to help contribute to the project if you could point me in the right direction!

Thanks

pushqrdx commented 2 years ago

@tylermmorton thanks for the kind words :)

Making this plugin more generic has been in the back of my mind for so long and I wish there was a clean way to implement it. However, vscode's syntax highlighting injection is pretty limited, the main blocker would be changing the injection rules dynamically and as far as I know there is no way to do that on the fly.