Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements to snippets and syntaxes #32

Open
15 of 25 tasks
GlenNicholls opened this issue Nov 7, 2019 · 11 comments
Open
15 of 25 tasks

Enhancements to snippets and syntaxes #32

GlenNicholls opened this issue Nov 7, 2019 · 11 comments
Assignees

Comments

@GlenNicholls
Copy link
Contributor

GlenNicholls commented Nov 7, 2019

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

  • rising_edge/falling_edge
  • event
  • all types in ieee: real/integer/signed/unsigned/std_logic/etc. (functions too?)
  • ensure all identifiers are highlighted. Instead of blue, they should be another color
  • single quotes ' '
    • this might be tough due to the tick ' being valid. Possibly check to make sure there's something between two single quotes. Making this a different color from the double quote would be helpful as well
  • highlight number in parenthesis or just on their own to make picking out ranges, generics/ports, and addressing a bit easier
  • block comments (vhdl2008)
  • time units

Snippets

The following need to be added to snippets

  • entity
  • component
  • architecture
  • all types in ieee: real/integer/signed/unsigned/std_logic/etc. Possibly abbreviations for sl/slv etc.
  • package
  • ieee libraries
  • function
  • procedure
  • context (vhdl2008)
  • process
  • case
  • case generate (vhdl 2008)
  • with select
  • when
  • others
  • while
  • for
  • for generate
  • if/elsif/else
  • if generate
  • if/else generate (vhdl2008)
  • convert entity/component to instance like this
    • probably needs macro
  • auto-fill case statement for FSM if select type has FSM states
    • probably needs macro
@GlenNicholls
Copy link
Contributor Author

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

@GlenNicholls
Copy link
Contributor Author

GlenNicholls commented Nov 12, 2019

@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
Copy link
Contributor Author

GlenNicholls commented Nov 12, 2019

@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
Copy link
Contributor

eine commented Nov 12, 2019

@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 pushed a commit to GlenNicholls/ghdl-language-server that referenced this issue Nov 12, 2019
@GlenNicholls
Copy link
Contributor Author

@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
Copy link
Contributor Author

@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?

GlenNicholls pushed a commit to GlenNicholls/ghdl-language-server that referenced this issue Nov 13, 2019
@tgingold
Copy link
Member

tgingold commented Nov 13, 2019 via email

@tgingold
Copy link
Member

tgingold commented Nov 13, 2019 via email

@GlenNicholls
Copy link
Contributor Author

GlenNicholls commented Nov 13, 2019

@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.

GlenNicholls pushed a commit to GlenNicholls/ghdl-language-server that referenced this issue Nov 14, 2019
… takes longer than just writing it manually
@tgingold
Copy link
Member

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

@GlenNicholls
Copy link
Contributor Author

@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 :/

GlenNicholls pushed a commit to GlenNicholls/ghdl-language-server that referenced this issue Nov 15, 2019
@GlenNicholls GlenNicholls mentioned this issue Nov 15, 2019
tgingold pushed a commit that referenced this issue Nov 15, 2019
* Adding snippets per /issues/32

* more snippets added for /issues/32

* fixed bugs in snippets and added todos

* moved todos for #32 and removed attributes since typing that word takes longer than just writing it manually

* organizing a bit and moving snippets to multiple files

* moved snippets to seperate files based on logical ordering and updated package.json

* re-organized before merging with master for #32

* fixed file name issue and duplicate snippet in interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants