Skip to content

Fixed #59395 - Emmet Syntax Profiles tag_nl produces no extra space#60108

Merged
ramya-rao-a merged 3 commits intomicrosoft:masterfrom
irrationalRock:fix-59395
Oct 23, 2018
Merged

Fixed #59395 - Emmet Syntax Profiles tag_nl produces no extra space#60108
ramya-rao-a merged 3 commits intomicrosoft:masterfrom
irrationalRock:fix-59395

Conversation

@irrationalRock
Copy link
Contributor

This PR fixes #59395.

With:

"emmet.syntaxProfiles": {
        "html": {
            "tag_nl": false            
        }
    },

It no longer allows extra space.

Before:
vscode-59395-before

After:
vscode-59395

Thanks for considering this request.

Copy link
Contributor

@ramya-rao-a ramya-rao-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests seem to be failing. Can you take a look at that?

To run the tests locally, run scripts\test-integration.bat on Windows or ./scripts/test-integration.sh on Linux/Mac

It would also do us good to add a test case to cover this scenario.
wrapWithAbbreviation.test.ts would be the file to update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably get the value for tag_nl from expandOptions.profile object

@irrationalRock
Copy link
Contributor Author

Thanks for the feedback. I'm looking at the tests and will update tag_nl to expandOptions.profile

@irrationalRock
Copy link
Contributor Author

I updated my code to use expandOptions.profile. I'm wondering if you can give me an example of how to change the config in tests. I am having some problems trying to change tag_nl to false.

Copy link
Contributor

@ramya-rao-a ramya-rao-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies, I should have cleared some things previously.

The new emmet modules that we use dont use the same syntaxProfile settings as documented in https://docs.emmet.io/customization/syntax-profiles/

The new emmet modules follow the profile as defined in https://github.com/emmetio/output-profile/blob/1a7571e78da9d7bf056289b3396dbb0bcc45c435/types.d.ts#L1

To support backward compatibility in VS Code, we support both in the settings. I convert the old profile to a new one using a helper

So now coming to the current issue. You can just add expandOptions['format'] === true to the if condition and that should be enough.

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Oct 12, 2018

I'm wondering if you can give me an example of how to change the config in tests.

https://github.com/Microsoft/vscode/blob/release/1.28/extensions/emmet/src/test/abbreviationAction.test.ts#L441 is an example where I changed the config for the emmet.excludeLanguages setting. You can use that as an example.

@irrationalRock
Copy link
Contributor Author

Thanks for the help. I had to use expandOptions['profile'].format instead of expandOptions['format'] because it didn't seem to produce any properties when tag_nl was set to true.
I also added tests for this feature.

@irrationalRock
Copy link
Contributor Author

It seems like my commits fail when running the hygiene tests. Is there any way for me to run these tests on my local machine? Running ./scripts/test-integration.sh passes all of the tests.

@ramya-rao-a
Copy link
Contributor

The hygiene failure was due to formatting errors. I have pushed a change to fix that.

@ramya-rao-a ramya-rao-a merged commit 19ac31a into microsoft:master Oct 23, 2018
@ramya-rao-a ramya-rao-a added this to the October 2018 milestone Oct 23, 2018
@contentfree
Copy link

Wrap still produces incorrect results if tag_nl_leaf is false, I believe. (tag_nl_leaf doesn't seem to be respected at all, really, nor does the 'decide' value for tag_nl)

@ramya-rao-a
Copy link
Contributor

@contentfree I have logged an upstream issue for that. See https://github.com/emmetio/output-profile/issues/1

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emmet Syntax Profiles tag_nl adds extra white space

3 participants