emmetio / nova-plugin

Emmet plugin for Panic’s Nova editor
MIT License
26 stars 11 forks source link

Auto-complete stopped working #42

Open starkis opened 3 years ago

starkis commented 3 years ago

Not sure if this is an issue with Nova, the Emmet extension, or something I've done—auto-complete just stopped working. (I've tried restarting and reinstalling the extension.)

The 'Expand Abbreviation' command (Control-E) still works, but I much prefer to just type and hit tab. If I run Nova's 'Show Completions' command, the pop-up shows the exact characters I've already typed (marked as 'Emmet'), and then several other suggestions, but none of them include the complete markup. (See screenshot.)

Screen Shot 2021-05-10 at 5 32 20 pm

Environment (please complete the following information):

sergeche commented 3 years ago

It might depend on syntax you’re using, try to set syntax to HTML. Also, check out Emmet preferences and make sure Enable Autocomplete option is enabled

starkis commented 3 years ago

I should have mentioned that I already checked Emmet preferences and made sure 'Enable auto-complete' was enabled. Yes, syntax is set to HTML.

Screen Shot 2021-05-11 at 8 40 16 am Screen Shot 2021-05-11 at 8 45 13 am

alonsofedz commented 3 years ago

I would like to add myself to this report. In my case I just installed the Extension, so don't have any previous experience of it auto-completing. The "Expand Abbreviation" command works, and the "Show Completions" command also shows the available expansions.

Removed all extensions to see if there was any conflict. Changed keyboard layout to US. Tried a fresh install in a new user account.

Don't know if it's an Emmet Extension bug or a Nova bug though. I downgraded to 6.1 and it works. I'll submit a but report on their end as well.

starkis commented 3 years ago

I can also confirm that it works (mostly) after downgrading to Nova 6.1. It now shows the suggestions automatically as I type, and provided I type in the complete abbreviation, hitting Tab or Return generates the expected code. However, if I start typing and then use the arrow keys to select another option, hitting Tab or Return completes the abbreviation but it doesn't generate the expanded code. For example:

  1. Select item: Screen Shot 2021-05-11 at 1 23 23 pm

  2. Hit Tab or Return: Screen Shot 2021-05-11 at 1 21 27 pm

Hitting Tab or Return a second time doesn't expand the abbreviation.

danielucas commented 3 years ago

Adding myself to this issue as well—Emmet fully stopped working in 6.2. Any information on how to downgrade to 6.1; or word on an update to the extension/Nova to fix this issue?

sergeche commented 3 years ago

Will take a look, might be some kind of API regression.

logancollins commented 3 years ago

Chiming in: The completions not appearing appears to be being triggered by some changes in Nova 6.2 related to adjusting selected ranges in an editor. Emmet is returning an empty set of completions after typing a character (but not after hitting Escape or Ctrl-Space).

The change in Nova is effectively causing it to send two selection change events when typing. Emmet is observing that change, and for whatever reason, now that it's sent twice, it's internal tracking of the caret is not behaving as expected. I'm not sure if Nova is sending the wrong coordinates, or something else?

I'm still investigating on our side. Nova should probably not be sending two events in this case, which I can remedy. But I'm not sure why sending two would affect Emmet in this way.

logancollins commented 3 years ago

For the html:5 expansion specifically, it appears that Emmet is not returning a value for insertText in that completion (among others). Nova inserts the label of the completion in its absence. This may or may not be related to the other issue above.

starkis commented 3 years ago

Any information on how to downgrade to 6.1 …

An archive of older versions can be found here: https://download.panic.com/nova

starkis commented 3 years ago

Thank you @sergeche and @logancollins for working on a fix for this. Emmet is one of those tools you don't know how you lived without once you start using it. 🙂

danielucas commented 3 years ago

Any information on how to downgrade to 6.1 …

An archive of older versions can be found here: https://download.panic.com/nova

Thanks @starkis — and totally agreed, not being able to use Emmett is more or less a dealbreaker for me!

tomliv commented 3 years ago

Adding myself as well. HTML in .php docs specifically, but overall it's not working for me.

ecurtis commented 3 years ago

I just want to confirm the other posters experience and I look forward to getting the autocomplete back. Thank you to the developers of this extension, it is my favorite.

mrcury commented 3 years ago

Autocomplete stopped working for me as well on 6.2 (probably on 6.1 too), on SCSS and HTML files. The Emmet dropdown options while typing are also gone.

sergeche commented 3 years ago

@logancollins did some investigation of this issue. Indeed, the problem is that Nova sends onDidChangeSelection twice: before and after editor update. Which breaks Emmet abbreviation tracking as user types text.

Since there’s no way to detect what user entered in onDidChange callback (or at least I didn’t found it), I’m using a combination of onDidChangeSelection and onDidChange callbacks. In previous versions, onDidChangeSelection was invoked after onDidChange so when user enters something, I take stored caret location from previous onDidChangeSelection call and compare it with caret location in onDidChange — the difference is the value user entered so I can validate it as abbreviation and continue tracking.

In Nova 6.2, onDidChangeSelection is invoked before onDidChange so in this logic it looks like user entered nothing and I can find another way how to get value entered by user

sergeche commented 3 years ago

@logancollins another issue I found is incorrect JS VM behaviour. There’s a trick in JS world to schedule code execution after all other code in current task with Promise.resolve():

function test() {
  console.log(1);
  Promise.resolve().then(() => console.log(2));
  console.log(3);
}

If you run this code in browser, you’ll get 1 3 2 output since Promise creates micro-task, which is executed before current task finished but after other code in current task. However, in Nova the output will be 1 2 3, at least in onDidChangeSelection callback. I’ve tried to use this trick to suppress extra selection change callback before edit callback but no luck

daviddarnes commented 3 years ago

Also been experiencing this, to be honest I didn't know there was an auto-complete dropdown until seeing it in the docs here 😅. Are the Panic team aware of the events issue causing this bug?

jakw0j commented 3 years ago

same issue: Nova 6.2 Build 271290

sunststudio commented 3 years ago

Same here, Emmet auto-complete not working with Nova 6.2.

alonsofedz commented 3 years ago

Seems to be fixed in Nova 7.0. Can anyone else confirm?

tomy0000000 commented 3 years ago

@alonsofedz just confirmed, seems working

daviddarnes commented 3 years ago

Can confirm it's auto-complete is now working for me in Nova 7. However when I had this nunjucks highlighter on it refused to spring up even if I opened a HTML file, only seemed to work in it's own contained window. I've turned off the nunjucks highlighter for now and switched to this Twig syntax highlighter, which admittedly is probably better as it comes with auto-complete built in 😅

starkis commented 3 years ago

Still not working as it should in 7.0. Yes, you can type in anything and hit tab or return to create opening and closing tags, but if you select a valid tag from the pop-up suggestions, no tags for you! Basically unchanged from 6.1. (See my earlier comment.)

daviddarnes commented 3 years ago

@starkis ah yes I see now, sorry for muddying the thread. It does work if you select the item and then hit CTRL + E if that is workable for now

starkis commented 3 years ago

Thanks @daviddarnes. Personally I'd rather type in the whole tag name than:

  1. Use the down arrow key to select the tag.
  2. Hit tab or return.
  3. Hit control-E.

Sure, it works, but it's a three step process. I would expect Emmet to work like normal code completion, where the top suggestion can be triggered in one step, just by hitting tab or return, and other suggestions in two steps.

daviddarnes commented 3 years ago

@starkis of course, but like I said it's workable if people are really needing to use it in some form. I'm not denying it should be fixed / improved 😄

maxime-pigeon commented 1 year ago

Any update on this issue ? Autocomplete with tab or return is still not working for me on Nova 10.6. It works in CSS but not in HTML.

sergeche commented 1 year ago

@maxime-pigeon seems to work fine. Please make sure you’ve set correct HTML syntax and enabled completions in Emmet plugin

image
maxime-pigeon commented 1 year ago

Thank you for responding so quickly @sergeche. Sorry for being unclear; you’re right, it does work with operators, but some of the snippets don’t. For instance, ! or html:5 don’t expand when I select them in the autocomplete pop up.

sergeche commented 1 year ago

@maxime-pigeon do you see underline and i icon on gutter when you type ! or html:5 abbreviation? If you do, it means Emmet works as expected, however, there are some issues with Nova API which may not activate autocomplete if you type non-Latin character

tomliv commented 1 year ago

I am having the same issue, especially with typing html in a new doc. I see the i you mentioned, however when I type html I see the Emmet suggestions, I arrow down to the one I want, hit return or tab (same result with either) but nothing happens. I end up with html:5 in plain text in an otherwise blank document. No non-latin characters. I used Emmet and it didn't work regardless of the i icon

sergeche commented 1 year ago

@tomliv does your autocomplete looks like this when you type html?

image
tomliv commented 1 year ago

It does, yes

On Tue, Apr 4, 2023 at 5:40 AM Sergey Chikuyonok @.***> wrote:

@tomliv https://github.com/tomliv does your autocomplete looks like this when you type html? [image: image] https://user-images.githubusercontent.com/93595/229752356-533938b7-13b3-4659-830a-b321654aba66.png

— Reply to this email directly, view it on GitHub https://github.com/emmetio/nova-plugin/issues/42#issuecomment-1495660077, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIZXILU2VZ6MPXBH7VCNHDW7PUANANCNFSM44QPUQNA . You are receiving this because you were mentioned.Message ID: @.***>

--

Tom Livingston | Senior Front End Developer | Media Logic | ph: 518.456.3015x231 | fx: 518.456.4279 | medialogic.com

663399

sergeche commented 1 year ago

My guess here is that you’re typing html and then pick html:5 expecting to get a full snippet behind html:5. But instead it just completes word in editor.

A few key points that should be considered here:

When you type html and then complete it with html:5, you actually pick a snippet completion and modify abbreviation. And since you pick a completion, Nova hides autocomplete popup so you can’t use Tab or Enter, you should either invoke autocomplete again with Ctrl-Space or run Expand Abbreviation action. Unfortunately, there’s no API in Nova to override Tab key as in other editors (Sublime Text, VSCode) to get a better DX with completions.

sergeche commented 1 year ago

As for typing ! abbreviation, it’s a long-standing issue in Nova: it doesn’t invoke autocomplete popup if you type non-Latin character so you can’t use Tab to complete it. You have to either invoke autocomplete manually with Ctrl-Space then Tab, or run Expand Abbreviation action

tomliv commented 1 year ago

Awesome, thanks! That works!

On Wed, Apr 5, 2023 at 4:54 AM Sergey Chikuyonok @.***> wrote:

My guess here is that you’re typing html and then pick html:5 expecting to get a full snippet behind html:5. But instead it just completes word in editor.

A few key points that should be considered here:

  • Emmet acts as autocomplete provider: your options are either type abbreviation and complete it via autocomplete workflow (pick suggestion, use Tab or Enter key) or run Expand Abbreviation action manually anywhere in code. In autocomplete mode, plugin tracks abbreviation as you type in order to accumulate complex input and provide preview (hence underlined text and i icon in gutter)
  • Emmet provides a few suggestions in autocomplete: the first one is to expand abbreviation (marked with $), all the rest are just names of Emmet snippets which you can complete (just snippet names, not expanded abbreviations!) so you can accumulate larger abbreviation with completions.

When you type html and then complete it with html:5, you actually pick a snippet completion and modify abbreviation. And since you pick a completion, Nova hides autocomplete popup so you can’t use Tab or Enter, you should either invoke autocomplete again with Ctrl-Space or run Expand Abbreviation action. Unfortunately, there’s no API in Nova to override Tab key as in other editors (Sublime Text, VSCode) to get a better DX with completions.

— Reply to this email directly, view it on GitHub https://github.com/emmetio/nova-plugin/issues/42#issuecomment-1497145713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIZXIK4LI2Y7X4EHD3XVKDW7UXOHANCNFSM44QPUQNA . You are receiving this because you were mentioned.Message ID: @.***>

--

Tom Livingston | Senior Front End Developer | Media Logic | ph: 518.456.3015x231 | fx: 518.456.4279 | medialogic.com

663399