Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport intelephense docblock customization #1340
Comments
|
Here it is is how to do that Line 153 in 843000b Also, you could set them without having a defcustom via:
|
|
@yyoncho I'm not really fluent in elisp as to be able to provide a PR To manually set them should I do it before or after initializing |
|
I think that :config is the right place. |
|
Can you please post an example of setting a json snippet? I want to set {
"summary": "$1",
"tags": [
"",
"@param ${1:$SYMBOL_TYPE} $SYMBOL_NAME $2",
"",
"@return ${1:$SYMBOL_TYPE} $2",
"@throws ${1:$SYMBOL_TYPE} $2"
]
}Would be something like:
Thanks. |
It does not require elisp skills - you have several properties already defined - you just have to do the same for those who are not present.
Use |
|
To get what I described in the comment above I tried this: (lsp-register-custom-settings
'(("intelephense.phpdoc.functionTemplate"
(list :summary "$1"
:tags (vector ""
"@param ${1:$SYMBOL_TYPE} $SYMBOL_NAME $2"
""
"@return ${1:$SYMBOL_TYPE} $2"
"@throws ${1:$SYMBOL_TYPE} $2""" "$1")))))But this is what is sent to the server in the initialization string: ...
"phpdoc": {
"functionTemplate": [
"list",
"summary",
"$1",
"tags",
[
"vector",
"",
"@param ${1:$SYMBOL_TYPE} $SYMBOL_NAME $2",
"",
"@return ${1:$SYMBOL_TYPE} $2",
"@throws ${1:$SYMBOL_TYPE} $2",
"",
"$1"
]
]
}
...It's all sent as arrays and not objects... As I said earlier, I'm not skilled in elisp and I'm probably not writing it correctly. Can I get some help please? |
|
Should be like that: (lsp-register-custom-settings
`(("intelephense.phpdoc.functionTemplate"
,(list :summary "$1"
:tags (vector ""
"@param ${1:$SYMBOL_TYPE} $SYMBOL_NAME $2"
""
"@return ${1:$SYMBOL_TYPE} $2"
"@throws ${1:$SYMBOL_TYPE} $2""" "$1"))))) |
|
As I said... I suck at elisp |
|
Just out of curiosity... whats the difference between |
|
@gjm I am aware that inteliphense has this ability, but not how to trigger the auto completion. I imagine typing /** should trigger the autocompletion, but this does not work for me. |
|
@charles-ritchie autocompletion triggers on I'm assuming you know you have to buy a premium license for this to work... |
|
@gjm hmmm still does not work for me. I have a premium license, so must be some form of configuration issue. |
|
@charles-ritchie are you sure your premium license is active? I had some issues with it at first. If you |
|
@gjm yeah most definitely, as I am using many of the other premium features and all providers are shown as enabled for the session. Could you possibly share your lsp-mode config? |
|
@charles-ritchie sure... It's quite simpe.. https://gist.github.com/gjm/e4e7ec1c345c24b964eb62edcd88d58a |
|
@gjm thanks for that. So I have quite a few extra packages for/integration with lsp-mode, so I might create a barebones emacs config and see if this helps. |
|
Just a hint for future searchers: You can use embedded elisp code in the templates just as in yasnippet snippets: (lsp-register-custom-settings
`(("intelephense.phpdoc.functionTemplate"
,(list :summary "$1"
:tags (vector "@param ${1:$SYMBOL_TYPE} $SYMBOL_NAME $2"
""
"@return ${1:$SYMBOL_TYPE} $2"
"@throws ${1:$SYMBOL_TYPE} $2"
"@author tregner"
"@since `(tom/insert-current-date 4)`")))))Resulting in: /**
*
*
* @return int
* @author tregner
* @since February 21, 2020
*/ |


Intelephense's docblock generator has some nice customization settings. Would be great to expose them in
lsp-mode.See this issue for details.