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

Mark is lost after vue files are formated on save #77

Open
mauchchhash opened this issue Apr 8, 2022 · 8 comments
Open

Mark is lost after vue files are formated on save #77

mauchchhash opened this issue Apr 8, 2022 · 8 comments

Comments

@mauchchhash
Copy link

mauchchhash commented Apr 8, 2022

My .vue files are formated when I save. The issue occurs when I set a mark on a line. When I save the file and it formats the codes, then the mark is lost and the nvim error says "E20: Mark is not set". I have disabled this extension and it then this issue doesn't occur anymore. So the issue is with this extension.

Steps to reproduce:

  1. set a mark on a line in a .vue file.
  2. change the format of the code a bit so it formats when you save.
  3. Attempt to jump to your mark.

Thanks.

@chemzqm
Copy link
Member

chemzqm commented Apr 9, 2022

What's your CocInfo?

@mauchchhash
Copy link
Author

mauchchhash commented Apr 9, 2022

@chemzqm My CocInfo:

versions

vim version: NVIM v0.6.1
node version: v16.13.2
coc.nvim version: 0.0.80-0428328f9a
coc.nvim directory: /home/xxxxxx/.nvim/plugged/coc.nvim
term: xterm-256color
platform: linux

Log of coc.nvim

2022-04-09T07:48:04.118 INFO (pid:179478) [plugin] - coc.nvim initialized with node: v16.13.2 after 862ms
2022-04-09T07:48:06.493 INFO (pid:179478) [attach] - receive notification: showInfo []

@mauchchhash
Copy link
Author

@chemzqm Hi just checking. Have you checked it out?

@chemzqm
Copy link
Member

chemzqm commented Apr 17, 2022

It's because vls send changes for all the lines:

[Trace - 8:35:01 PM] Received response 'textDocument/formatting - (1)' in 634ms.
Result: [
    {
        "range": {
            "start": {
                "line": 0,
                "character": 10
            },
            "end": {
                "line": 5,
                "character": 0
            }
        },
        "newText": "\n  <div id=\"app\">\n    <img alt=\"Vue logo\" src=\"./assets/logo.png\" />\n    <HelloWorld msg=\"Welcome to Your Vue.js + TypeScript App\" />\n  </div>\n"
    },
    {
        "range": {
            "start": {
                "line": 7,
                "character": 18
            },
            "end": {
                "line": 22,
                "character": 0
            }
        },
        "newText": "\nimport Vue from \"vue\";\nimport HelloWorld from \"./components/HelloWorld.vue\";\n\nexport default Vue.extend({\n  name: \"app\",\n  components: {\n    HelloWorld,\n  },\n  methods: {\n    wrong(): string {\n      return \"\";\n    },\n  },\n});\n"
    },
    {
        "range": {
            "start": {
                "line": 24,
                "character": 7
            },
            "end": {
                "line": 33,
                "character": 0
            }
        },
        "newText": "\n#app {\n  font-family: \"Avenir\", Helvetica, Arial, sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n  text-align: center;\n  color: #2c3e50;\n  margin-top: 60px;\n}\n"
    }
]

it should calculate necessary changes instead.

@mauchchhash
Copy link
Author

mauchchhash commented Apr 17, 2022

@chemzqm I don't understand what those codes mean 😅. I hope there is fix...

@chemzqm
Copy link
Member

chemzqm commented Apr 17, 2022

It means all your lines get replaced and neovim not track your marker, should be fixed by vls.

@mauchchhash
Copy link
Author

mauchchhash commented Apr 17, 2022

So there's nothing I can do from my end right? Or do I need to create an issue somewhere else like "vuejs/vetur"?

@chemzqm
Copy link
Member

chemzqm commented Apr 17, 2022

Don't know, but I prefer that vls to fix this issue.

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

No branches or pull requests

2 participants