首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用python的vim:[缺失函数- docstring ]缺少函数或方法docstring

使用python的vim:[缺失函数- docstring ]缺少函数或方法docstring
EN

Stack Overflow用户
提问于 2022-08-11 14:39:02
回答 1查看 139关注 0票数 -2

我有ViM9.0和Python支持:我已经安装了Python的自动完成和语法检查。以下是我的~/..vimrc文件内容:

代码语言:javascript
复制
set nocompatible              " required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)

" ...

Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'vim-syntastic/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Bundle 'Valloric/YouCompleteMe'


set clipboard=unnamed

set nu

let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree

"if has('gui_running')
"  set background=dark
"  colorscheme solarized
"else
"  colorscheme zenburn
"endif

"so ~/.vim/bundle/vim-colors-solarized/autoload/togglebg.vim


let python_highlight_all=1
syntax on

let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g  :YcmCompleter GoToDefinitionElseDeclaration<CR>

set splitbelow
set splitright

"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

" Enable folding
set foldmethod=indent
set foldlevel=99

" Enable folding with the spacebar
nnoremap <space> za

"au BufNewFile,BufRead *.py
"    \ setlocal tabstop=4 set softtabstop=4 set shiftwidth=4 set textwidth=79 set expandtab set autoindent set fileformat=unix

au FileType *.js, *.html, *.css
    \ setlocal tabstop=2 set softtabstop=2 set shiftwidth=2

"au BufNewFile,BufRead *.js,*.html,*.css,*.vue
"\ set tabstop=2 |
"\ set softtabstop=2 |
"\ set shiftwidth=2

"Flagging Unnecessary Whitespace
highlight BadWhitespace ctermbg=red guibg=darkred
au FileType *.py, *.pyw, *.c, *.h match BadWhitespace /\s\+$/

"au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/


set encoding=utf-8

"All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

为了测试Python支持,我创建了一个简单的脚本,如下图所示。它有两行奇怪的警告:缺少函数- docstring、缺少函数或方法docstring。

我怎样才能抑制这种错误/警告呢?

EN

回答 1

Stack Overflow用户

发布于 2022-08-26 14:06:17

没什么好担心的。这是YCM插件的正常行为:

GetDoc子命令: 显示在游标下填充了有关标识符的快速信息的预览窗口。根据文件类型的不同,这包括以下内容:

  • 标识符的类型或声明,
  • DO2/javadoc评论,
  • Python文档字符串,
  • 等。

因此,当尝试执行其GetDoc功能以显示光标下的函数信息时,YCM简单地告诉您,函数testing()没有与其关联的文档。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73322546

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档