fig icon indicating copy to clipboard operation
fig copied to clipboard

Fig stopped showing completions after adding spec to ~/.fig/autocomplete

Open clo4 opened this issue 2 years ago • 9 comments

I created a custom local script (in the main ~/.fig/autocomplete, messed up fig somehow because popup stopped appearing for all other specs. Realised later that I probably had to create it in ~/.fig/user/autocomplete

clo4 avatar Mar 28 '22 23:03 clo4

Hi, I was the one encountering the issue. To be honest I'm not sure it's a bug in the tool but more of a chance of improving the docs.

I was following the docs to create the specs for an internal tooling and the documentation only shows how to publish the spec & share it with my team; which I don't necessarily want to do (but I realise why you consider it as happy path as this helps you strengthen your network effect).

I later realised that there's a command npm run copy-to-global that allows me to copy my private spec to my main ~/.fig autocomplete.

During this whole process all autocompletes except the one I just added stopped working. I didn't want to troubleshoot so I just uninstalled & re-installed again right away, and that's how this issue got here.

dreamorosi avatar Mar 29 '22 15:03 dreamorosi

This is definitely a good opportunity for improving the docs. We need to do a major revamp of them.

My usual workflow for editing personal specs:

# First time setup:
#   cd
#   npx @withfig/autocomplete-tools@latest init

cd ~/.fig/autocomplete
npm run create-spec SPEC_NAME
code . --goto src/SPEC_NAME.ts  # or vim src/SPEC_NAME.ts

# Edit spec, then run this to test it:
npm run build

This avoids switching to dev mode. Developer mode in autocomplete makes it only load from ./build, instead of doing a normal lookup. You can still do npm run dev, but this means no other specs will load.

Hope that made sense! We'll have to think of ways to make this much clearer in the future.

clo4 avatar Mar 29 '22 23:03 clo4

Thanks for the update, I can confirm that I wasn't in dev mode. Before resorting to uninstalling I have tried with different terminal sessions and nothing worked.

I'll keep in mind your workflow though, thanks!

dreamorosi avatar Mar 30 '22 10:03 dreamorosi

Hi, I was the one encountering the issue. To be honest I'm not sure it's a bug in the tool but more of a chance of improving the docs.

I was following the docs to create the specs for an internal tooling and the documentation only shows how to publish the spec & share it with my team; which I don't necessarily want to do (but I realise why you consider it as happy path as this helps you strengthen your network effect).

I later realised that there's a command npm run copy-to-global that allows me to copy my private spec to my main ~/.fig autocomplete.

During this whole process all autocompletes except the one I just added stopped working. I didn't want to troubleshoot so I just uninstalled & re-installed again right away, and that's how this issue got here.

we load specs from ~/.fig/autocomplete/build and ~/.fig/user/autocomplete/build. I should have updated the copy-to-global script a while ago. Edit: On February 3rd to be exact, if you created your local fig autocomplete spec before that date I'd suggest you to recreate it.

fedeci avatar Mar 31 '22 14:03 fedeci

Understood, I've created the spec 5 days ago.

dreamorosi avatar Mar 31 '22 14:03 dreamorosi

Than that's not the problem😄

fedeci avatar Mar 31 '22 14:03 fedeci

Sorry for the long delay here. We've updated our docs to reflect the new method for creating private completions. If you still have the .ts file you created for the spec, you can just run

npx @fig/publish-spec --spec-path path/to/spec.ts

as documented here https://fig.io/docs/guides/autocomplete-for-internal-tools#4-publish-your-spec.

We unfortunately did not make this breaking change to private specs very clear. Apologies for the inconvenience -- we are working towards improving our changelog and giving advanced notice for breaking changes.

Let me know if you are able to get this working or run into any issues

sullivan-sean avatar Sep 14 '22 18:09 sullivan-sean

Hello, when I run:

npx @fig/publish-spec --spec-path ~/.fig/autocomplete/src/my-cli.ts

The changes do not take effect unless I also run:

fig restart

Is that expected? Thanks.

terheyden avatar Sep 23 '22 17:09 terheyden

It isn't expected but it may be a matter of seconds. I'll see if I can reproduce.

fedeci avatar Sep 24 '22 06:09 fedeci