Conversation
Before of this, SH syntax was used in ENV files. It was OK, but it limited the extensible of the syntax, what it prevented add support to specific characteristics of some "`.env processors", like that from CodeIgniter4 (it supports dots: "foo.bar=0"). It also allows to improve the syntax pretty and code legibility (mainly because the highlight is not breaked by spaces). Currently, it does not "allow" indentation (it breaks highlight of fields/variables, and comments when they are not in line start. Signed-off-by: DuckAfire <155199080+duckafire@users.noreply.github.com>
I removed `*.env{rc,}` from `autocmd` used to set SH filetype.
Signed-off-by: DuckAfire <155199080+duckafire@users.noreply.github.com>
|
I think I undestand what it is wrong, but I do not have certain of how to fix it. Because of this I just will wait for the professionals. Tip The main is below: |
Revised by github@zeertzjq Signed-off-by: DuckAfire <155199080+duckafire@users.noreply.github.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Its use and declaration was inspired in `json.vim`, but it is unnecessary here. Actually, I really do not know whether I understand the purpose of this variable in `json.vim` context. But it is not important in this context. Signed-off-by: DuckAfire <155199080+duckafire@users.noreply.github.com>
Remove ENV files from object returned by `s:GetFilenameChecks()` (from `sh` field), and add them, and new supported variantions, to a new field (`env`) to ENV files. Signed-off-by: DuckAfire <155199080+duckafire@users.noreply.github.com>
|
I understand what is wrong, but I do not know what causes these problems. I think I did not edit nothing related with "server state". Tip See |
There was a problem hiding this comment.
Thanks for the PR. However, I'm not sure it's safe to restrict these files to simple parameter definitions, let's see what others think.
Linguists supports it as a dedicated filetype: https://github.com/github-linguist/linguist/blob/e51c227048a02a8a1b0fae6e72214e7c5f327c73/lib/linguist/languages.yml#L1762-L1784
Dotenv:
type: data
color: "#e5d559"
extensions:
- ".env"
filenames:
- ".env"
- ".env.ci"
- ".env.dev"
- ".env.development"
- ".env.development.local"
- ".env.example"
- ".env.local"
- ".env.prod"
- ".env.production"
- ".env.sample"
- ".env.staging"
- ".env.template"
- ".env.test"
- ".env.testing"
tm_scope: source.dotenv
ace_mode: text
language_id: 111148035
> 1 - Apply standard indent for VimScript (x2 spaces). 2 - Replace `\(\)` to `\%(\)` (`envField`; because capturing group is unused). 3 - Apply normal spelling of `:syntax` (`:syn`), instead shortest (`:sy`). 4 - Apply singular form to `envTitles` (syntax group name). 5 - Fix match of `envTitle` to avoid titles stacked in a same line. 6 - Remove `*.envrc` and `.envrc.*` from set of ENV files. 7 - Readd ENVRC files to: * `sh` field from object returned by `s:GetFilenameChecks()`. * `autocmd` used to set SH syntax highlight. 8 - Improve match of ENVRC. Signed-off-by: DuckAfire <155199080+duckafire@users.noreply.github.com>
|
I am confused, why is this line there: Doesn't this set the filetype to |
Based on what I read and understood (from source code):
Based in what I know, ENV is not a SH file, it is a file to declarate environment variables. This means support of other resources of SH (keywords; operators; ...) does not always supported. Note Before this PR, ENV files use SH syntax highlight. Why do you think ENV to be "moved"? |
Sorry for the errors related with code conventions, I am new here. About the ENVRC, I did not know this file, nor its purpose. I throght it was legacy name to environment files, or a name low used. I gave back ENVRC to the place where they were. I also improved the its match. Do you think files names ( |
That is the correct filetype for
The change adding |
|
Thanks. The thing that threw me off was that this PR is about highlighting ENV files and did not talk about envrc files. We should separate those two things. into at least separate commits. One commits adds the |
As said before, I just change ENVRC match because I thought I was a variation of ENV files. After to be warnied about this, I putted it again in its original place - together with small improvements in its match pattern. You are right, it would have been better to divide the fixing of the script syntax, and the eddition of the ENVRC match, I will take this into consideration in possible future PRs. |
|
Alright, the one thing that keeps me from including this right now is that it’s slightly backwards-incompatible: |
Add a simple syntax highlight to files named as:
*.env{rc,}; and.env{rc,}.*.Note
File type name is
env.Tip
Examples:
.env.examplebackup.env000.envrcIt covers the follow items:
/^\h\(\w\|\.\)*/);#):CAUNTION,NOTE,TODO,WARN,WARNING),=, and end of the line).Note
I did not use the "classic To do tags" because I think it does not fit into this context.
The main objective of this PR is to improve the syntax beauty*, code legibility,
and syntax extensibility**.
Note
7ebf6a7a7189d2be7562c9da70f2c24ecdc9535b).Below there is an example code, copy it, and run the syntax script to see how it works.
When I was making this, I’m a bit confused whether I need to add
.envextension toft_from_extor not, because there is no about.envthere, even it is a validextension (without self syntax). So, for now, I do not added it.
Note
My English is a little bad, so they can have some gramatical errors here and in my
commits messages - I'm trying to improve it daily.