ghdl / ghdl-language-server

Language server based on ghdl
MIT License
88 stars 8 forks source link

Enhancements to snippets and syntaxes #32

Open GlenNicholls opened 4 years ago

GlenNicholls commented 4 years ago

The snippets and syntaxes are in rough form right now. The following should be added:

Syntaxes

The following keywords are not currently in the syntaxes

Snippets

The following need to be added to snippets

GlenNicholls commented 4 years ago

@1138-4EB @tgingold feel free to assign this to me and I can start knocking these out as I have time

GlenNicholls commented 4 years ago

@tgingold I am going through the current syntaxes to change the highlight colors for all identifiers. However, vscode doesn't have an easy way of doing this outside creating a new theme which I think is not good since it will force users to use a certain color scheme. I found this example from this blog

Basically, it uses a regexp to determine which scope is used for highlighting. Does this seem reasonable or is there a better way to highlight non-standard repositories while minimizing the manual intervention to support the default themes of VSC? For VHDL syntaxes, there would be no match condition for the capture other than the "keyword", but I would use that to ensure that the highlight color is supported in all default themes (as determined by the *.json under <VSC>/resources/app/extensions/theme-defaults)

GlenNicholls commented 4 years ago

@tgingold can I get permissions? I made a branch and I'm starting to commit my changes/additions to the snippets. It won't let me with the following error:

Glen.Nicholls@CL0285 MINGW64 ~/Desktop/ghdl-language-server (syntax_snippets)
$ git push origin syntax_snippets
remote: Permission to ghdl/ghdl-language-server.git denied to GlenNicholls.
fatal: unable to access 'https://github.com/ghdl/ghdl-language-server.git/': The requested URL returned error: 403
eine commented 4 years ago

@GlenNicholls, the regular procedure is to fork this repo to say GlenNicholls/ghdl-language-server, using the 'Fork' button above. Then, you push the branch to your repo. Last, you open a Pull Request, by selecting a branch from your repo.

GlenNicholls commented 4 years ago

@1138-4EB Can you check out my commit for the snippets in 4ce89e4? I am adding as much as I can and would like to organize the snippets.vhdl.json to be a bit more readable. Because comments are not supported, I am grouping everything with delimiters in the description. Do you see value in this or should I forego that and just have a short description for each snippet?

Also, what do you think about the above comment I made about the syntax highlighting?

GlenNicholls commented 4 years ago

@1138-4EB @tgingold I am also thinking about adding a snippet for a VHDL file header:

"File Header": {
        "prefix": ["FILE_HEADER"],
        "body": [
            "-----------------------------------------------------------------------------",
            "--",
            "-- Title  : ${1:<Title of File>}",
            "-- Design : ${2:<Title of Design>}",
            "-- Author : ${3:<Your Name>}",
            "-- Date   : $CURRENT_MONTH/$CURRENT_DATE/$CURRENT_YEAR $CURRENT_HOUR:$CURRENT_MINUTE",
            "-- File   : <$TM_FILENAME>",
            "--",
            "-----------------------------------------------------------------------------",
            "--",
            "-- Description",
            "--------------",
            "-- ${4:<Enter Description>}",
            "--",
            "-- Interface",
            "------------",
            "--",
            "-- TODO",
            "-------",
            "--",
            "-----------------------------------------------------------------------------"
        ],
        "description": "Standard file header"
    },

Obviously, the format could change, but I use that all the time. Is there value in adding this to the ghdl-ls vscode plugin, or is that too specific?

tgingold commented 4 years ago

Many people want to have an header, but rarely the same. How easily could it be customized by users ?

tgingold commented 4 years ago

I have to investigate. I think the existing identifiers are already highlighted on my setup.

GlenNicholls commented 4 years ago

@tgingold

Many people want to have an header, but rarely the same. How easily could it be customized by users ?

Hmmm, I don't think it would be an easy task. I'm not even sure that it would work with the provided snippet variables. I opened a VSC issue about allowing embedded snippets which would help. At this time, though, I don't think it would be possible for a user to customize the header without a macro or something.

I have to investigate. I think the existing identifiers are already highlighted on my setup.

Okay let me know. I have tried all default themes and turned off all VHDL extensions except ghdl-ls and they aren't highlighted at all for me.

tgingold commented 4 years ago

Here is what I get: Screenshot from 2019-11-14 14-09-57

GlenNicholls commented 4 years ago

@tgingold

Here is what I get: Screenshot from 2019-11-14 14-09-57

Do you have an hdl-proj.json file. In the default theme, I don't see any highlighting for the identifiers at all :/