hansec / fortran-language-server

Fortran Language Server for the Language Server Protocol
MIT License
296 stars 57 forks source link

Add support for Fortran scope/block snippets #47

Open hansec opened 6 years ago

hansec commented 6 years ago

Add snippet support for common fortran blocks (if, do, etc.) and scope declarations (module, subroutine, etc.).

examples ($0 denotes cursor position)

if($0)then
end if
module $0
end module $0
PaulXiCao commented 5 years ago

I found some other projects which have alrady implemented various snippets. Maybe we should just copy-paste them...

michaelkonecny commented 5 years ago

Is there a way to make these a bit more intelligent? In Atom, I often find myself typing end subtab and that inserts the snippet for an entire new subroutine, which is super annoying. Perhaps just adding a new snippet for end subroutine with prefix end sub would override the subroutine one in this case? I think it's the same thing for module, I just don't type that that often, so I don't remember at this moment.

EDIT: done in https://github.com/dparkins/language-fortran/pull/111

hansec commented 5 years ago

Yeah, one of the reasons I have not added this yet is that for Atom and VSCode at least the most common snippets are already provided (since the "language support" packages are required for the LS anyways). Beyond that getting the LS provided snippets and the "language support" package snippets to play nice is a little tricky, since you end up with two snippets that are almost identical. I hope to have some time to look in to this again soon though.