Comments (3)
Do you mean inspecting the body of the function which you're documenting to look at the return statement?
ie, the template inserted would look like this for these functions:
/**
* [foo description]
*/
function foo() { }
/**
* [bar description]
* @return [description]
*/
function bar() {
return 1;
}
If this is what you mean, then there's no plan to implement that. The plugin simply does some string comparisons against the surrounding code to infer what it can, and I would actually resist any attempt to make it do much more than that. It's not possible to reliably perform this sort of detection without building an entire source tree out of the file -- string comparison obviously can't tell the difference between nested functions, or the word "return" inside a string without getting really complicated. Plus, most of the time while you're editing a file, you don't actually have a valid document which makes a lot of the parsers worthless, since they'd just report a syntax error and die.
So, long story short: adding this sort of functionality is very complicated and couldn't be relied upon most of the time, whereas the alternative is that the developer manually delete a single line. Sorry!
However if I misunderstood the request, please do let me know, and I'd be happy to take another look.
from sublime-jsdocs.
You've understood correctly and I get the complexity of doing it 'properly'.
As a compromise (if the ST2 API makes this any simpler) how about finding the closing brace of the function and checking the line before? If it starts with return
then that would be a good indicator. This wouldn't catch return statements in the middle of a function with a fall back to an implicit null
return but it would pretty safe to assume that most functions returning something would return as the last thing it does.
from sublime-jsdocs.
This could possibly work, however it'd be a much larger change to the plugin than I have the time for right now. If you wanted to have a go at it, I'd be happy to accept pull-requests. I guess I see the 'stupidity' of the plugin as a positive thing 😃
from sublime-jsdocs.
Related Issues (20)
- Override package
- SASS Variable not working
- Incorrect param tags due to trailing commas
- Perl Support
- User settings seemed to not work in Sublime(3154) HOT 3
- Support ES6 constructor syntax
- php7,unsupported variable type array with default value HOT 1
- Variable names are not recognized in Typescript
- SassDoc
- Undocumented config options
- @return added with no return statement in function
- Feture Request: Add auto comment on tag end in HTML
- Bulk DocBlock Generation for a file or folder
- PHP7.4 bool getting confused by boolean HOT 1
- PHP7.4 Return type not being detected HOT 1
- DockBlock can't support go language
- Feature: param name position setting
- Default value for jsdocs_decorate
- How to format {{datetime}} as 'YYYY-MM-DD HH: mm: ss'?
- why sublime 4.x function's doc has not contain @return
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sublime-jsdocs.