Skip to content

Emmet: saving a file outside the current directory in the case of using Encode/Decode command #8569

Closed

Description

Help to testing #8207

VSCode Version: 1.3.0-insiders (a21c123)
OS Version: Windows 10 Pro (build 10586.420)

Steps to Reproduce:

  1. Open any directory and create a CSS file:

    .test { background-image: url(https://avatars1.githubusercontent.com/u/7034281?v=3&s=460) }
  2. Run Emmet: Encode\Decode.

  3. Run Emmet: Encode\Decode and write ../test.png.

  4. The file will be saved.

Questions:

  1. This is correct behavior?
  2. Prevent saving a file outside the current workspace? For example: "The path **{0}** is located outside the current workspace."
  3. Provide choice to the user?

P.S.: This is the last problem that i could find.

Activity

  1. added
    bug
    on Jun 30, 2016
  2. egamma commented on Jun 30, 2016

    @egamma
    Member

    Denis Malinochkin (@mrmlnc) a question about the implementation of the encode/decode support. Usually an emmet feature forwards to the corresponding emmet action. Why isn't this the case for encode/decode and there is quite some code in the action? My concern is that this code will need to be adapted when emmet evolves.

  3. mrmlnc commented on Jun 30, 2016

    @mrmlnc
    ContributorAuthor

    Erich Gamma (@egamma), problems:

    1. Emmet uses the synchronous API for save and does not know how to save files in the directory (save in fileAccessor.ts) 2e0f883#commitcomment-18085303
    2. Emmet throws errors when working with paths that don't exist.

    If it's a question of time, let's remove (temporarily: July 2016) support for Encode\Decode action. Other editors also implement the API for working with the file system.

  4. mrmlnc commented on Jun 30, 2016

    @mrmlnc
    ContributorAuthor

    Erich Gamma (@egamma), tomorrow (before lunch in Moscow 13:00 GMT+3) i can provide the code with comments (on good English language) that describe the what, where and why.

  5. egamma commented on Jul 1, 2016

    @egamma
    Member

    Denis Malinochkin (@mrmlnc) we are finishing the June update today, so I will remove the encode/decode action for June, then we have enough time to clean things up in July. This also means no stress for you with the update.

  6. egamma commented on Jul 1, 2016

    @egamma
    Member

    Denis Malinochkin (@mrmlnc)

    Emmet uses the synchronous API for save and does not know how to save files in the directory

    This fully explains the problem, thank you. Then we should revisit how to implement this emmet action. The current implementation also has the exception issue #8324.

  7. mrmlnc commented on Jul 1, 2016

    @mrmlnc
    ContributorAuthor

    Erich Gamma (@egamma),

    LGTM. I think this is the right thing to do. Please don't forget to remove this condition:

    https://github.com/Microsoft/vscode/blob/2e0f883bb0ae15c1172b3092791059ab3d96e41f/src/vs/workbench/parts/emmet/node/emmetActions.ts#L46

    if (Object.keys(syntaxProfile).length !== 0) { // <------------------------
        _emmet.profile.reset();
        _emmet.loadProfiles(syntaxProfile);
    }

    Description: #8542 (comment)

  8. mrmlnc commented on Jul 1, 2016

    @mrmlnc
    ContributorAuthor

    Erich Gamma (@egamma) soon I will prepare PR with a detailed explanation and comments.

  9. egamma commented on Jul 1, 2016

    @egamma
    Member

    Done thanks for the reminder to remove the condition, good catch 🌹

  10. removed this from the July 2016 milestone on Jul 27, 2016
  11. added
    emmet
    on Nov 12, 2016
  12. egamma commented on Apr 20, 2017

    @egamma
    Member

    I'm closing this one, we have no plans to add these actions.

  13. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugemmet

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions