Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Close CSS Code Hints after inputting property value #10524

Merged
merged 1 commit into from
Jul 23, 2016

Conversation

marcelgerber
Copy link
Contributor

For #9496 and #4888

if (lastContext === CSSUtils.PROP_VALUE) {
// close the session if we're coming from a property value
// see https://github.com/adobe/brackets/issues/9496
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

@marcelgerber Just a small thing. To adhere to how it is done everywhere can you change this to return null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed (& rebased)

@nethip
Copy link
Contributor

nethip commented Feb 6, 2015

@marcelgerber I took this change and it does not seem to solve #9496. I am not sure if this makes the issue better though.

@marcelgerber
Copy link
Contributor Author

Hm, it definitely works for me. So, just to be sure, these are the steps I followed:

  1. Type position: absolute;
  2. Place your mouse before the p
  3. Type (without using Code Hints!) left: auto; - without a trailing space
  4. Press Enter

Before: left: auto;align-content: : absolute;
After: left: auto;[Newline]position: absolute;

@kylelondonuk
Copy link

Hi, I opened issue #9496 and was wondering whether this fix is available yet? the problem still seems to exist in Brackets 1.3 downloaded today.

Cheers

@nethip
Copy link
Contributor

nethip commented Apr 27, 2015

@kylelondonuk This is not merged yet.

@ficristo
Copy link
Collaborator

FWIW I can confirm the STR above and this PR fixes it.

@marcelgerber
Copy link
Contributor Author

I do think this fix should be reviewed soon. Would you mind? Maybe @abose?

@ficristo
Copy link
Collaborator

There is a test failing under Extensions \ CSS Code Hinting. Could you take a look?

By the way I'd write the code like the following: I find it easier to read.

-            lastContext = CSSUtils.PROP_NAME;
+            if (lastContext === CSSUtils.PROP_VALUE) {
+                // Close the session if we're coming from a property value.
+                // See https://github.com/adobe/brackets/issues/9496
+                return null;
+            }
+
+            lastContext = CSSUtils.PROP_NAME;
             needle = needle.substr(0, this.info.offset);

@marcelgerber
Copy link
Contributor Author

@ficristo With latest master merged in, all tests pass for me.
I've also incorporated your suggested code style change.

@ficristo
Copy link
Collaborator

You are missing a brace.

@marcelgerber
Copy link
Contributor Author

Argh, yesterday simply wasn't my day. Fixed it now and squashed the commits as.
Should be good to go after one last look.

@ficristo
Copy link
Collaborator

Thank you, LGTM.

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.

None yet

4 participants