Prerequisites
Neovim Version
NVIM v0.11.0-dev-783+g0ade8fed1
Operating system/version
Arch Linux
Actual behavior
Dotenv parser don't let setting value that contains the # character.
var1=value#hashtag # this is a comment
var2="value#hashtag" # this is another comment
var3=thisisok # comment
results in
var1 = value
var2 = "value
var3 = thisisok
It also fails to process comments correctly.
results in var1 = bar
Expected behavior
a dotenv file like
var1=value#hashtag # this is a comment
var2="value#hashtag" # this is another comment
var3=thisisok # comment
# var3=thisisnotok
results in
var1 = value#hastag
var2 = value#hashtag
var3 = thisisok
Steps to reproduce
- Create a dotenv file with comments as described.
- Try to use the variables
They will contain the wrong values.
Other information
I made a partial solution in this PR: #513
It is not perfect because a dotenv file like
var1=value # with comment that # contais hash
will result in
var1 = value # with comment that
But more resilient then current implementation.
Can be used until implementation with tree-sitter-bash is made.
Repro (lazy.nvim)
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
"rest-nvim/rest.nvim",
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
main = "nvim-treesitter.configs",
opts = {
ensure_installed = { "http" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
},
},
},
})
Prerequisites
Neovim Version
NVIM v0.11.0-dev-783+g0ade8fed1
Operating system/version
Arch Linux
Actual behavior
Dotenv parser don't let setting value that contains the
#character.results in
It also fails to process comments correctly.
results in
var1 = barExpected behavior
a dotenv file like
results in
Steps to reproduce
They will contain the wrong values.
Other information
I made a partial solution in this PR: #513
It is not perfect because a dotenv file like
will result in
But more resilient then current implementation.
Can be used until implementation with tree-sitter-bash is made.
Repro (
lazy.nvim)