swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

SwaggerEditor@next: provide completion for $ref field starting with `#` character.

Open char0n opened this issue 1 year ago • 0 comments

Originally discussed in https://github.com/swagger-api/swagger-editor/issues/3216#issuecomment-1526096630

# is control character for starting of the YAML comment. Thus it's dropped from the resulting AST. We have to escape it with single or double quotes to represent the value, and then the proper completion is displayed.

$ref: #<cursor CTRL+b>

Steps To Reproduce

https://github.com/swagger-api/swagger-editor/assets/193286/5264442a-87d2-46a1-9ed8-732bb62d12e0

Notes

Now this might be a bit tricky to implement. When ApiDOM YAML 1.2 parser adapter parses the YAML string, we only collect YAML comments from the YAML stream. The rest of the comments are discarded as insignificant white space.

We have a tracking ApiDOM issue which, tracks the support for YAML comments outside of YAML stream. This issue will first need to be processed before this issue can be fix.

char0n avatar May 10 '23 09:05 char0n