web-mode icon indicating copy to clipboard operation
web-mode copied to clipboard

No indentation allowed for inline <script> tag?

Open sontek opened this issue 4 years ago • 6 comments

Hello, I'm coding some HTML that looks like this (its in a .ejs file if that matters):

<!doctype html>
<html lang="en">
    <head>
        <title>Introduction to WebRTC</title>
    </head>
    <body>
        <video autoplay></video>
        <script>
       *
        </script>
    </body>
</html>

My cursor is on the *. I'm trying to hit Tab here to indent to start coding the body of the script tag and it refuses to move. It just doesn't do anything at all. Interestingly, if I'm on the <script> tag and I say "insert line below" it does in fact indent it the way I expect.

So I have 2 questions:

  1. Can I get it to allow me to indent inside inline script tags?
  2. Can I get it to never refuse to do something I request of it? I'd prefer it always indent if I request it to. For example, if I opened a
    and hit tab twice, I'd prefer if it did 2 indentations rather than refusing to do so.

    Thanks!

sontek avatar Jun 08 '20 00:06 sontek

This has gotten much worse as I coded, I'm not sure whats going on now but I can't get it to match the formatting of the code at all, the code is all aligned on 4 spaces inside the inline and even "insert line below" has started outdenting to the weird location:

Jun-08-2020 12-37-21

sontek avatar Jun 08 '20 16:06 sontek

Sometimes it just fills in and autocompletes stuff that is not relevant to what I'm typing. For example, if I want to write a new listener:

Jun-08-2020 12-47-57

See how it autocompleted HTML tags and then added in the addEventListener in there while I was typing?

sontek avatar Jun 08 '20 16:06 sontek

@sontek please try with an empty .emacs

fxbois avatar Jun 08 '20 18:06 fxbois

At least with the indentations, its the same:

Jun-08-2020 14-43-39

sontek avatar Jun 08 '20 18:06 sontek

ok, with an empty one its just wanting to use 2 characters instead of 4 and it won't let me hit tab a second time to go to 4. Can I tell it not to refuse to do what I want? I like having some sane defaults but if it can't detect the format of the code then it'd be nice to have it not try to force the default, just suggest it

sontek avatar Jun 08 '20 18:06 sontek

HTML I'm using inside the .ejs file

<!doctype html>
<html lang="en">
    <head>
        <title>Introduction to WebRTC</title>
    </head>
    <body>
        <div>
            Video: <select id="camera"></select>
        </div>
        <script>
        </script>
    </body>
</html>

sontek avatar Jun 08 '20 18:06 sontek