rest.nvim icon indicating copy to clipboard operation
rest.nvim copied to clipboard

File variable support

Open mawkler opened this issue 2 years ago • 2 comments

VSC**es's REST client plugin, which is similar to rest.nvim, supports file variables. Here's an example to illustrate:

@baseUrl = https://test.url.com
@access_token = beepboopaccesstoken

###

DELETE {{baseUrl}}/posts/50
Authorization {{access_token}}

The team I work with all use VSC**e and so in the project root there's a .vscode/requests.http file with various requests to the services we're building, which is also checked into git. I was hoping to be able to use rest.nvim with this file, but it is filled with file variables like in the example above. I think file variable support would be really cool.

mawkler avatar Aug 12 '22 11:08 mawkler

is that some kind of standard or just this vscode extension's format ?

teto avatar Aug 22 '22 18:08 teto

@teto As far as I can tell this is only the extension's custom format. However, the extension does have 2.6 million installs so it is quite an established format in that sense. It's also a relatively simple format, syntax-wise.

mawkler avatar Aug 24 '22 15:08 mawkler

this would be so nice to have!

gegnew avatar Oct 11 '22 16:10 gegnew

apparently fixed buy #152 feel free to reopen if not the case

teto avatar Dec 29 '22 14:12 teto

That's great! Thank you very much @theNEOkun!

It would be great now if the Treesitter parser for HTTP supported this syntax. I noticed that it lives under the same GitHub organization, and I've created an issue here: rest-nvim/tree-sitter-http/issues/6.

mawkler avatar Jan 02 '23 12:01 mawkler

@NTBBloodbath Was this functionality removed in the new release?

mawkler avatar Apr 05 '24 07:04 mawkler

@NTBBloodbath Was this functionality removed in the new release?

Hi, nope. It still exists, only now if the variable contains text it must be enclosed in a string (@foo = "https://...") :)

NTBBloodbath avatar Apr 05 '24 10:04 NTBBloodbath

@NTBBloodbath I see, thank you!

mawkler avatar Apr 05 '24 12:04 mawkler