Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First line in <script> tags indented differently #50

Closed
tomatopeel opened this issue Sep 20, 2017 · 5 comments
Closed

First line in <script> tags indented differently #50

tomatopeel opened this issue Sep 20, 2017 · 5 comments
Labels
Milestone

Comments

@tomatopeel
Copy link

Hey,

I'm getting this behaviour where the first line within the <script> tags of any .vue file with vue-mode[JavaScript] enabled is indenting the first line with one more indent than the rest of the lines:

test_1

indent-line-function is mmm-indent-line but if I manually execute js-indent-line the behaviour is the same.

@AdamNiederer
Copy link
Owner

Hello,

Thanks for your report. I've experienced this issue as well, and have a fix in mind. I'll try to get it pushed up as soon as I have a free moment.

@AdamNiederer AdamNiederer added this to the 0.4 milestone Sep 21, 2017
AdamNiederer added a commit to AdamNiederer/mmm-mode that referenced this issue Sep 27, 2017
Sometimes, modes rely on functions like (point-min) or overstep their region
when attempting to indent a line. This can cause issues like
AdamNiederer/vue-mode#50

This function narrows the buffer before indenting, preventing any issues which
might arise from reliance on having one's own buffer.

This doesn't change any defaults, but I figured some other mmm-mode derivatives
could make use of this function.
@AdamNiederer
Copy link
Owner

Sent a patch: dgutov/mmm-mode#74

After this is accepted, I'll need to add a line in vue-initialize to use this new function. I'll also need to synchronize with mmm-mode for the next stable release.

@dgutov
Copy link

dgutov commented Sep 29, 2017

Regardless of whether that patch is accepted, you can include it in vue-mode in the meantime, right? I'm just guessing that you're going to want to further tweak that function, specifically for Vue syntax.

@AdamNiederer
Copy link
Owner

Apologies for the extremely long wait; I've decided to abandon merging the utility functions upstream and have just added them locally. This should be fixed now.

@sprhawk
Copy link
Contributor

sprhawk commented May 8, 2020

Why is mine still wrong for first line under script?

<template>
<div id='app'>
</div>
</template>

<script lang="ts">
    
    import Vue from 'vue'

export default Vue.extend({
    components: {
    },
    methods: {
    },
});

</script>

<style lang='scss' scoped>
  .canvas {
  width: 100%;
  height: 100%;
  }
</style>

<style lang='scss'>
  
html,body {
    overflow: hidden;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

</style>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants