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

losing multiple cursors when using format on save #37005

Closed
mgiraldo opened this issue Oct 26, 2017 · 5 comments
Closed

losing multiple cursors when using format on save #37005

mgiraldo opened this issue Oct 26, 2017 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug formatting Source formatter issues verified Verification succeeded
Milestone

Comments

@mgiraldo
Copy link

  • VSCode Version: Code 1.17.2 (b813d12, 2017-10-16T13:47:41.889Z)
  • OS Version: Darwin x64 16.7.0
  • Extensions:
Extension Author (truncated) Version
compulim-vscode-closetag Com 1.1.0
sublime-commands Zar 0.1.0
prettier-vscode esb 0.24.0
sublime-keybindings ms- 2.9.1
expand-selection-to-scope vit 0.2.0
sublime-text-pack wad 0.0.2

Steps to Reproduce:

  1. in a doc with some text that repeats
  2. select one of the repeating instances
  3. Cmd+D multiple times to select all repeating instances
  4. multiple cursors/selections are created
  5. change to something else (type 'abc')

Expected result:
Changes are saved and cursors are maintained.

Actual result:
Only first cursor remains.

Reproduces without extensions: could not launch code without extensions.

@vscodebot vscodebot bot added editor editor-multicursor Editor multiple cursor issues labels Oct 26, 2017
@alexdima
Copy link
Member

@mgiraldo I cannot reproduce in a .txt file. Are you perhaps seeing this only in certain file types ?

@alexdima alexdima added the info-needed Issue requires more information from poster label Oct 30, 2017
@mgiraldo
Copy link
Author

that's true. i'm using React. i cannot reproduce in txt either. try saving this code in js format:

import React from "react";
import fetch from "isomorphic-fetch";

import MainLayout from "../../components/MainLayout";
import AllExhibitions from "../../components/ExhibitionsComponents/AllExhibitions";
import Footer from "../../components/ExhibitionsComponents/Footer";
import { getCurrentUrl } from "utilFunctions";
import {
  EXHIBITS_ENDPOINT,
  EXHIBIT_PAGES_ENDPOINT,
  FILES_ENDPOINT
} from "constants/exhibitions";

const Exhibitions = ({ url, exhibitions }) =>
  <MainLayout route={url}>
    <AllExhibitions route={url} exhibitions={exhibitions} />
    <Footer />
  </MainLayout>;

Exhibitions.getInitialProps = async ({ req }) => {
  const currentUrl = getCurrentUrl(req);
  const exhibitsRes = await fetch(`${currentUrl}${EXHIBITS_ENDPOINT}`);
  const exhibitsJson = await exhibitsRes.json();
  const exhibitions = await Promise.all(
    exhibitsJson
      .map(async exhibit => {
        const exhibitPageRes = await fetch(
          `${currentUrl}${EXHIBIT_PAGES_ENDPOINT}?exhibit=${exhibit.id}`
        );
        const exhibitJson = await exhibitPageRes.json();

        const itemId = exhibitJson.find(
          exhibit =>
            exhibit.slug === "home-page" ||
            exhibit.slug === "homepage" ||
            exhibit.order === 0
        ).page_blocks[0].attachments[0].item.id;
        const filesRes = await fetch(
          `${currentUrl}${FILES_ENDPOINT}?item=${itemId}`
        );
        const filesJson = await filesRes.json();

        const thumbnailUrl = filesJson[0].file_urls.fullsize;
        return Object.assign({}, exhibit, { thumbnailUrl });
      })
      .reverse()
  );

  return { exhibitions };
};

export default Exhibitions;

@alexdima
Copy link
Member

@mgiraldo I have just tried with the code you've provided and I could not reproduce on a default installation of VS Code. I believe one of your installed extensions might be doing something on save (editing, formatting or something) to .js files ?

@mgiraldo
Copy link
Author

mgiraldo commented Oct 31, 2017

true... Prettier does that… i have "editor.formatOnSave": true, in my user settings… this is a vscode native setting, right? should it take this into account?

🤔

@alexdima
Copy link
Member

alexdima commented Nov 1, 2017

You're right, I could reproduce this using editor.formatOnSave with the built-in TypeScript formatter.

@alexdima alexdima removed the editor-multicursor Editor multiple cursor issues label Nov 1, 2017
@alexdima alexdima changed the title losing multiple cursors when saving losing multiple cursors when using format on save Nov 1, 2017
@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Nov 1, 2017
@alexdima alexdima added this to the Backlog milestone Nov 1, 2017
@jrieken jrieken added the formatting Source formatter issues label Nov 1, 2017
@jrieken jrieken modified the milestones: Backlog, December 2017/January 2018 Dec 15, 2017
@jrieken jrieken closed this as completed in 61a035c Jan 9, 2018
@rebornix rebornix added the verified Verification succeeded label Feb 1, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug formatting Source formatter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants