The most valuable aspect of Fig is the definition of completion standards. Here I mark down how to customize standards and put them into production use.
Examples of Completion Spec
- cd command:https://github.com/withfig/autocomplete/blob/master/src/cd.ts
- echo command:https://github.com/withfig/autocomplete/blob/master/src/echo.ts
- git command:https://github.com/withfig/autocomplete/blob/master/src/git.ts#L4024
Click here
Contributing to the Official Fig Completion Repository
The official readme has made it very clear.
That is, fork repo and then follow the instructions to generate completion standards => test => submit PR
1 | Replace `YOUR_GITHUB_USERNAME` with your own GitHub username |
Bypassing the Official Repo
Besides submitting contributions to the official repo, you can also create your own project to write completions, steps as follows.
1 | Create spec |
When the above dev is executed, it has already been compiled into TS and registered to index.js, but because it is a separate repo, the index.js only registered the single custom-created specification. In actual use, after confirming the specification is usable, it can be placed in the official specification folder together for packaging.
1 | const completionSpec: Fig.Spec = { |
The registration method in index.js is as follows.
1 | var e=["ak"],diffVersionedCompletions=[];export{e as default,diffVersionedCompletions}; |
Toggling Development Mode
Direct GUI operation in CodeWhisperer is possible.
If it’s the Fig App, the following command can be used to toggle.
1 | fig settings autocomplete.developerModeNPM false |