Open benjie opened 4 years ago
is it a required argument value? it could be like with required fields, where required arguments are automatically presented by default. i think the capability exists to extend the lsp this way somewhat. you can add additional validation rules to the lsp to say that arguments are required for specific fields or all fields with arguments. we dont have a way to extend code completion much yet. the code in monaco to add completion items is trivial, and usually i just pass the fieldname of the completion item, but you could do a lookup there real quick and have the completion replacement token include arguments. so you would choose allFilms from the dropdown, and it would automatically be added with required arguments
if they arent required then it would make sense as a plugin that different frameworks could use. Ill add it to the core plugins list
They're not required; specifically with Relay cursor pagination you may specify first
or last
or neither. However it's best practices to ensure that you have added a pagination limit (you don't want to pull down thousands of records, for example); so it would be nice to have an opt-in plugin that automatically adds a limit to remind the programmer they should set that value (or replace it with last: 10
or whatever).
For example when autocompleting a Relay connection
allFilms
we could make it so that it auto-completes toallFilms(first: 10)
to ensure that pagination limits are hinted. Needs thought on how this would actually work, but it'd be nice if our plugin system was capable of allowing someone to implement this.