emacs-vs / ts-docstr Goto Github PK
View Code? Open in Web Editor NEWA document string minor mode using tree-sitter
Home Page: https://emacs-vs.github.io/ts-docstr/
License: GNU General Public License v3.0
A document string minor mode using tree-sitter
Home Page: https://emacs-vs.github.io/ts-docstr/
License: GNU General Public License v3.0
Hi, thanks for making this package available. I've been looking for something that supports Google-style docstrings for Python and this seems like the most promising choice going forward. I especially like the use of Treesitter underneath. It shows a lot of potential.
Unfortunately I can't quite get the package to work out of the box. I have set it up with 'google
style Python docstrings and to trigger on typing """
. The result ends up indented twice as much as it should be.
PS: I noticed you use the word "triggeration" in the README to refer to the activation of a trigger. The usual word for this is simply "triggering". Hope you don't mind the correction.
This package looks very promising. When I try ts-docstr-at-point
I get the error Language is either not supported or WIP... c++mode
.
I load tree-sitter
and ts-docstr
as follows:
(use-package tree-sitter
:straight (tree-sitter :host github :repo "emacs-tree-sitter/elisp-tree-sitter"))
(use-package tree-sitter-langs
:straight (tree-sitter-langs :host github :repo "emacs-tree-sitter/tree-sitter-langs"))
(use-package msgu
:straight (msgu :host github :repo "jcs-elpa/msgu"))
(use-package ts-docstr
:straight (ts-docstr :host github :repo "emacs-vs/ts-docstr"))
I then visit a cpp
file and call M-x ts-docstr-at-point
on a function.
Am I doing this wrong?
I get the error "Could not find package msgu. Updating recipe repos..." when trying to install. The same error is returned after running straight-pull-recipe-repositories
and re-trying as well.
Hi!
As you probably know, emacs29 includes built in support for tree-sitter grammars with a library called treesit
. Unfortunately it's incompatible with the older out-of-tree tree-sitter.el
that this package is based on. Are you interested in porting it / would you accept a patch to port it, which would make this package only work on emacs 29+?
If a C function is declared like:
struct point {
int x;
int y;
};
int foo(struct point p) {
return p.x + p.y;
}
ts-docstr-at-point
will fail with the error:
user-error: Multiple declarations are invalid, 2
.
I think this is triggered by the use of the struct
keyword, as a basic or typedef name won't cause this issue.
Hello,
When I run the straight.el snippet, I get the following backtrace:
Debugger entered--Lisp error: (error "Failed to run \"git\"; see buffer *straight-process*")
error("Failed to run %S; see buffer %s" "git" "*straight-process*")
straight--process-output("git" "branch" "-r")
straight-vc-git--default-remote-branch("origin" "ts-docstr")
straight-vc-git-clone((:repo "emacs-vs/ts-docstr" :fetcher github :files (:defaults "langs/*.el") :package "ts-docstr" :type git :local-repo "ts-docstr") nil)
apply(straight-vc-git-clone ((:repo "emacs-vs/ts-docstr" :fetcher github :files (:defaults "langs/*.el") :package "ts-docstr" :type git :local-repo "ts-docstr") nil))
straight-vc(clone git (:repo "emacs-vs/ts-docstr" :fetcher github :files (:defaults "langs/*.el") :package "ts-docstr" :type git :local-repo "ts-docstr") nil)
straight-vc-clone((:repo "emacs-vs/ts-docstr" :fetcher github :files (:defaults "langs/*.el") :package "ts-docstr" :type git :local-repo "ts-docstr"))
straight--clone-repository((:repo "emacs-vs/ts-docstr" :fetcher github :files (:defaults "langs/*.el") :package "ts-docstr" :type git :local-repo "ts-docstr") nil)
#f(compiled-function () #<bytecode 0x567b26c3de2ebe7>)()
straight--transaction-exec(use-package-\"c362823fcddd97fd224e3003d7691faa\"-nil-nil :now #f(compiled-function () #<bytecode 0x567b26c3de2ebe7>))
straight-use-package((ts-docstr :repo "emacs-vs/ts-docstr" :fetcher github :files (:defaults "langs/*.el")))
(progn (straight-use-package '(ts-docstr :repo "emacs-vs/ts-docstr" :fetcher github :files (:defaults "langs/*.el"))) (defvar use-package--warning74 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" ... keyword ...))) (display-warning 'use-package msg :error)))) (condition-case err (if (not (require 'ts-docstr nil t)) (display-warning 'use-package (format "Cannot load %s" 'ts-docstr) :error)) ((debug error) (funcall use-package--warning74 :catch err))))
(progn (defvar bootstrap-version) (progn (straight-use-package '(ts-docstr :repo "emacs-vs/ts-docstr" :fetcher github :files (:defaults "langs/*.el"))) (defvar use-package--warning74 #'(lambda (keyword err) (let ((msg ...)) (display-warning 'use-package msg :error)))) (condition-case err (if (not (require 'ts-docstr nil t)) (display-warning 'use-package (format "Cannot load %s" 'ts-docstr) :error)) ((debug error) (funcall use-package--warning74 :catch err)))))
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
command-execute(eval-last-sexp)
In the buffer straight-process it says:
$ cd /home/debz/.config/emacs/straight/repos/
$ git clone --origin origin --no-checkout emacs-vs/ts-docstr /home/debz/.config/emacs/straight/repos/ts-docstr/ --no-single-branch
fatal: repository 'emacs-vs/ts-docstr' does not exist
[Return code: 128]
$ cd /home/debz/.config/emacs/straight/repos/ts-docstr/
$ git branch -r
[File error while Setting current directory]
This package not exist on melpa, elpa or any other just now.
It'd be nice if this package could support the yasnippet format for fields like function summaries and argument descriptions. Numpydoc features it as an option, see GIF towards the bottom of the README: https://github.com/douglasdavis/numpydoc.el
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.