Comments (5)
@berndartmueller
Hi, thank you for comment.
What do you mean about use an appropriate formatter
.
Do you want to use something like *.js -> JsDoc format, *.ts -> TsDoc format?
Can you tell me little more detail?
from vim-jsdoc.
It would be great to have based on the current file (.js, .ts) either JsDoc or TsDoc used for formatting.
For now I set TsDoc as my default formatter, but occasionally I work on .js files and then it would be great to automatically format it with JsDoc.
from vim-jsdoc.
How about this?
Put followings to your .vimrc
function! s:jsdoc_formatter() abort
if &filetype == 'typescript'
let g:jsdoc_formatter = 'tsdoc'
elseif &filetype == 'javascript'
let g:jsdoc_formatter = 'jsdoc'
endif
endfunction
autocmd BufWinEnter,BufNewFile *.ts,*.js call s:jsdoc_formatter()
from vim-jsdoc.
Awesome!
Thanks a lot @heavenshell
I extended your script slightly to have different formatter loaded too.
function! s:jsdoc_formatter() abort
if &filetype == 'typescript'
let g:jsdoc_formatter = 'tsdoc'
let g:jsdoc_templates_path = '~/.vim/vim-jsdoc/ts-formatter.js'
elseif &filetype == 'javascript'
let g:jsdoc_formatter = 'jsdoc'
let g:jsdoc_templates_path = '~/.vim/vim-jsdoc/js-formatter.js'
endif
endfunction
from vim-jsdoc.
Great!
from vim-jsdoc.
Related Issues (20)
- Does not work on multi lines parameters HOT 1
- yarn.lock changes prevent vim-plug from updating vim-jsdoc HOT 1
- 不是编辑器的命令: commentstring< comments< HOT 3
- No @return in JS HOT 2
- E1208: -complete used without allowing arguments HOT 1
- JsDoc is not an editor command for filetype=javascriptreact/typescriptreact HOT 4
- Support for updating existing JSDoc comments? HOT 12
- Multiline function definitions don't work HOT 2
- E492: Not an editor command: JsDoc HOT 13
- TypeScript inputs configuration HOT 13
- Return Type Includes Arrorw with Flow and Arrow Functions HOT 4
- Error thrown for some functions HOT 1
- nullable @member syntax issue HOT 1
- jsdoc.vim v2.0.0 HOT 3
- windows offer HOT 1
- Unknown function: job_start HOT 3
- Any plan on supporting neovim? HOT 1
- How to use the interactive mode in 2.0.0? HOT 6
- Does not work with async functions HOT 2
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 vim-jsdoc.