Merge pull request #20545 from lewis6991/remove_cscope

This commit is contained in:
Lewis Russell 2022-10-14 09:53:15 +01:00 committed by GitHub
commit 9931db2e3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 138 additions and 3260 deletions

View File

@ -254,7 +254,7 @@ jobs:
if: matrix.os == 'linux' if: matrix.os == 'linux'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y autoconf automake build-essential cmake cpanminus cscope gcc-multilib gdb gettext language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip sudo apt-get install -y autoconf automake build-essential cmake cpanminus gcc-multilib gdb gettext language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip
- name: Install minimum required version of cmake - name: Install minimum required version of cmake
if: matrix.cmake == 'minimum_required' if: matrix.cmake == 'minimum_required'

View File

@ -28,7 +28,7 @@ jobs:
- name: Install apt packages - name: Install apt packages
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y autoconf automake build-essential cmake cpanminus cscope gcc-multilib gdb gettext language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip sudo apt-get install -y autoconf automake build-essential cmake cpanminus gcc-multilib gdb gettext language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v2

View File

@ -20,11 +20,6 @@ check_include_files(langinfo.h HAVE_LANGINFO_H)
check_include_files(locale.h HAVE_LOCALE_H) check_include_files(locale.h HAVE_LOCALE_H)
check_include_files(pwd.h HAVE_PWD_H) check_include_files(pwd.h HAVE_PWD_H)
check_include_files(strings.h HAVE_STRINGS_H) check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
if(NOT HAVE_SYS_WAIT_H AND UNIX)
# See if_cscope.c
message(SEND_ERROR "header sys/wait.h is required for Unix")
endif()
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H) check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(termios.h HAVE_TERMIOS_H) check_include_files(termios.h HAVE_TERMIOS_H)
check_include_files(sys/uio.h HAVE_SYS_UIO_H) check_include_files(sys/uio.h HAVE_SYS_UIO_H)

View File

@ -806,7 +806,7 @@ OptionSet After setting an option (except during
QuickFixCmdPre Before a quickfix command is run (|:make|, QuickFixCmdPre Before a quickfix command is run (|:make|,
|:lmake|, |:grep|, |:lgrep|, |:grepadd|, |:lmake|, |:grep|, |:lgrep|, |:grepadd|,
|:lgrepadd|, |:vimgrep|, |:lvimgrep|, |:lgrepadd|, |:vimgrep|, |:lvimgrep|,
|:vimgrepadd|, |:lvimgrepadd|, |:cscope|, |:vimgrepadd|, |:lvimgrepadd|,
|:cfile|, |:cgetfile|, |:caddfile|, |:lfile|, |:cfile|, |:cgetfile|, |:caddfile|, |:lfile|,
|:lgetfile|, |:laddfile|, |:helpgrep|, |:lgetfile|, |:laddfile|, |:helpgrep|,
|:lhelpgrep|, |:cexpr|, |:cgetexpr|, |:lhelpgrep|, |:cexpr|, |:cgetexpr|,

View File

@ -96,8 +96,6 @@ cos({expr}) Float cosine of {expr}
cosh({expr}) Float hyperbolic cosine of {expr} cosh({expr}) Float hyperbolic cosine of {expr}
count({comp}, {expr} [, {ic} [, {start}]]) count({comp}, {expr} [, {ic} [, {start}]])
Number count how many {expr} are in {comp} Number count how many {expr} are in {comp}
cscope_connection([{num}, {dbpath} [, {prepend}]])
Number checks existence of cscope connection
ctxget([{index}]) Dict return the |context| dict at {index} ctxget([{index}]) Dict return the |context| dict at {index}
ctxpop() none pop and restore |context| from the ctxpop() none pop and restore |context| from the
|context-stack| |context-stack|
@ -1436,47 +1434,6 @@ count({comp}, {expr} [, {ic} [, {start}]]) *count()*
Can also be used as a |method|: > Can also be used as a |method|: >
mylist->count(val) mylist->count(val)
< <
*cscope_connection()*
cscope_connection([{num} , {dbpath} [, {prepend}]])
Checks for the existence of a |cscope| connection. If no
parameters are specified, then the function returns:
0, if there are no cscope connections;
1, if there is at least one cscope connection.
If parameters are specified, then the value of {num}
determines how existence of a cscope connection is checked:
{num} Description of existence check
----- ------------------------------
0 Same as no parameters (e.g., "cscope_connection()").
1 Ignore {prepend}, and use partial string matches for
{dbpath}.
2 Ignore {prepend}, and use exact string matches for
{dbpath}.
3 Use {prepend}, use partial string matches for both
{dbpath} and {prepend}.
4 Use {prepend}, use exact string matches for both
{dbpath} and {prepend}.
Note: All string comparisons are case sensitive!
Examples. Suppose we had the following (from ":cs show"): >
# pid database name prepend path
0 27664 cscope.out /usr/local
<
Invocation Return Val ~
---------- ---------- >
cscope_connection() 1
cscope_connection(1, "out") 1
cscope_connection(2, "out") 0
cscope_connection(3, "out") 0
cscope_connection(3, "out", "local") 1
cscope_connection(4, "out") 0
cscope_connection(4, "out", "local") 0
cscope_connection(4, "cscope.out", "/usr/local") 1
<
ctxget([{index}]) *ctxget()* ctxget([{index}]) *ctxget()*
Returns a |Dictionary| representing the |context| at {index} Returns a |Dictionary| representing the |context| at {index}
from the top of the |context-stack| (see |context-dict|). from the top of the |context-stack| (see |context-dict|).
@ -2981,7 +2938,6 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
color color schemes color color schemes
command Ex command command Ex command
compiler compilers compiler compilers
cscope |:cscope| suboptions
diff_buffer |:diffget| and |:diffput| completion diff_buffer |:diffget| and |:diffput| completion
dir directory names dir directory names
environment environment variable names environment environment variable names

View File

@ -524,7 +524,6 @@ that see the '"' as part of their argument:
:cexpr (and the like) :cexpr (and the like)
:cdo (and the like) :cdo (and the like)
:command :command
:cscope (and the like)
:debug :debug
:display :display
:echo (and the like) :echo (and the like)
@ -566,7 +565,6 @@ followed by another Vim command:
:cdo :cdo
:cfdo :cfdo
:command :command
:cscope
:debug :debug
:eval :eval
:folddoopen :folddoopen
@ -575,7 +573,6 @@ followed by another Vim command:
:global :global
:help :help
:helpgrep :helpgrep
:lcscope
:ldo :ldo
:lfdo :lfdo
:lhelpgrep :lhelpgrep
@ -586,7 +583,6 @@ followed by another Vim command:
:python :python
:registers :registers
:read ! :read !
:scscope
:sign :sign
:terminal :terminal
:vglobal :vglobal

View File

@ -128,7 +128,6 @@ NORMAL COMMANDS
OPTIONS OPTIONS
- *cpo-<* *:menu-<special>* *:menu-special* *:map-<special>* *:map-special* - *cpo-<* *:menu-<special>* *:menu-special* *:map-<special>* *:map-special*
`<>` notation is always enabled. `<>` notation is always enabled.
- *'cscopeverbose'* Enabled by default. Use |:silent| instead.
- *'exrc'* *'ex'* Security risk: downloaded files could include - *'exrc'* *'ex'* Security risk: downloaded files could include
a malicious .nvimrc or .exrc file. See 'secure'. a malicious .nvimrc or .exrc file. See 'secure'.
Recommended alternative: define an autocommand in your Recommended alternative: define an autocommand in your

View File

@ -168,7 +168,6 @@ GUI ~
|gui.txt| Graphical User Interface (GUI) |gui.txt| Graphical User Interface (GUI)
Interfaces ~ Interfaces ~
|if_cscop.txt| using Cscope with Vim
|if_perl.txt| Perl interface |if_perl.txt| Perl interface
|if_pyth.txt| Python interface |if_pyth.txt| Python interface
|if_ruby.txt| Ruby interface |if_ruby.txt| Ruby interface

View File

@ -1,374 +0,0 @@
*if_cscop.txt* Nvim
VIM REFERENCE MANUAL by Andy Kahn
*cscope* *Cscope*
Cscope is a "code intelligence" tool that helps you navigate C programs. It
can also perform some refactoring tasks, such as renaming a global variable in
all source files. Think of it as "ctags on steroids".
See |cscope-usage| for a quickstart.
Type |gO| to see the table of contents.
==============================================================================
Cscope introduction *cscope-intro*
Cscope is designed to answer questions like:
Where is this symbol used?
Where is it defined?
Where did this variable get its value?
What is this global symbol's definition?
Where is this function in the source files?
What functions call this function?
What functions are called by this function?
Where does the message "out of space" come from?
Where is this source file in the directory structure?
What files include this header file?
Cscope answers these questions from a symbol database that it builds the first
time it is used on the source files. On a subsequent call, cscope rebuilds
the database only if a source file has changed or the list of source files is
different. When the database is rebuilt the data for the unchanged files is
copied from the old database, which makes rebuilding much faster than the
initial build.
See |cscope-usage| to get started.
==============================================================================
Cscope commands *cscope-commands*
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E560* *E561*
All cscope commands are accessed through suboptions to the cscope commands.
`:cscope` or `:cs` is the main command
`:scscope` or `:scs` does the same and splits the window
`:lcscope` or `:lcs` uses the location list, see |:lcscope|
The available subcommands are:
*E563* *E564* *E566* *E568* *E622* *E623* *E625*
*E626* *E609*
add : Add a new cscope database/connection.
USAGE :cs add {file|dir} [pre-path] [flags]
[pre-path] is the pathname used with the -P command to cscope.
[flags] are any additional flags you want to pass to cscope.
EXAMPLES >
:cscope add /usr/local/cdb/cscope.out
:cscope add /projects/vim/cscope.out /usr/local/vim
:cscope add cscope.out /usr/local/vim -C
<
*cscope-find* *cs-find* *E567*
find : Query cscope. All cscope query options are available
except option #5 ("Change this grep pattern").
USAGE :cs find {querytype} {name}
{querytype} corresponds to the actual cscope line
interface numbers as well as default nvi commands:
0 or s: Find this C symbol
1 or g: Find this definition
2 or d: Find functions called by this function
3 or c: Find functions calling this function
4 or t: Find this text string
6 or e: Find this egrep pattern
7 or f: Find this file
8 or i: Find files #including this file
9 or a: Find places where this symbol is assigned a value
For all types, except 4 and 6, leading white space for {name} is
removed. For 4 and 6 there is exactly one space between {querytype}
and {name}. Further white space is included in {name}.
EXAMPLES >
:cscope find c vim_free
:cscope find 3 vim_free
<
These two examples perform the same query: functions calling
"vim_free". >
:cscope find t initOnce
:cscope find t initOnce
<
The first one searches for the text "initOnce", the second one for
" initOnce". >
:cscope find 0 DEFAULT_TERM
<
Executing this example on the source code for Vim 5.1 produces the
following output:
Cscope tag: DEFAULT_TERM
# line filename / context / line
1 1009 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"amiga"
2 1013 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"win32"
3 1017 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"pcterm"
4 1021 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"ansi"
5 1025 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"vt52"
6 1029 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"os2ansi"
7 1033 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"ansi"
8 1037 vim-5.1-gtk/src/term.c <<GLOBAL>>
# undef DEFAULT_TERM
9 1038 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"beos-ansi"
10 1042 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"mac-ansi"
11 1335 vim-5.1-gtk/src/term.c <<set_termname>>
term = DEFAULT_TERM;
12 1459 vim-5.1-gtk/src/term.c <<set_termname>>
if (STRCMP(term, DEFAULT_TERM))
13 1826 vim-5.1-gtk/src/term.c <<termcapinit>>
term = DEFAULT_TERM;
14 1833 vim-5.1-gtk/src/term.c <<termcapinit>>
term = DEFAULT_TERM;
15 3635 vim-5.1-gtk/src/term.c <<update_tcap>>
p = find_builtin_term(DEFAULT_TERM);
Enter nr of choice (<CR> to abort):
The output shows several pieces of information:
1. The tag number (there are 15 in this example).
2. The line number where the tag occurs.
3. The filename where the tag occurs.
4. The context of the tag (e.g., global, or the function name).
5. The line from the file itself.
help : Show a brief synopsis.
USAGE :cs help
*E261*
kill : Kill a cscope connection (or kill all cscope connections).
USAGE :cs kill {num|partial_name}
To kill a cscope connection, the connection number or a partial
name must be specified. The partial name is simply any part of
the pathname of the cscope database. Kill a cscope connection
using the partial name with caution!
If the specified connection number is -1, then _ALL_ cscope
connections will be killed.
reset : Reinit all cscope connections.
USAGE :cs reset
show : Show cscope connections.
USAGE :cs show
*:lcscope* *:lcs*
This command is same as the ":cscope" command, except when the
'cscopequickfix' option is set, the location list for the current window is
used instead of the quickfix list to show the cscope results.
*:cstag* *E257* *E562*
If you use cscope as well as ctags, |:cstag| allows you to search one or
the other before making a jump. For example, you can choose to first
search your cscope database(s) for a match, and if one is not found, then
your tags file(s) will be searched. The order in which this happens
is determined by the value of |csto|. See |cscope-options| for more
details.
|:cstag| performs the equivalent of ":cs find g" on the identifier when
searching through the cscope database(s).
|:cstag| performs the equivalent of |:tjump| on the identifier when searching
through your tags file(s).
==============================================================================
Cscope options *cscope-options*
Use the |:set| command to set all cscope options. Ideally, you would do
this in one of your startup files (e.g., vimrc). Some cscope related
variables are only valid within |init.vim|. Setting them after vim has
started will have no effect!
*cscopeprg* *csprg*
'cscopeprg' specifies the command to execute cscope. The default is
"cscope". For example: >
:set csprg=/usr/local/bin/cscope
<
*cscopequickfix* *csqf* *E469*
'cscopequickfix' specifies whether to use quickfix window to show cscope
results. This is a list of comma-separated values. Each item consists of
|cscope-find| command (s, g, d, c, t, e, f, i or a) and flag (+, - or 0).
'+' indicates that results must be appended to quickfix window,
'-' implies previous results clearance, '0' or command absence - don't use
quickfix. Search is performed from start until first command occurrence.
The default value is "" (don't use quickfix anyway). The following value
seems to be useful: >
:set cscopequickfix=s-,c-,d-,i-,t-,e-,a-
<
*cscopetag* *cst*
If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t"
will always use |:cstag| instead of the default :tag behavior. Effectively,
by setting 'cst', you will always search your cscope databases as well as
your tag files. The default is off.
*cscoperelative* *csre*
If 'cscoperelative' is set, then in absence of a prefix given to cscope
(prefix is the argument of -P option of cscope), basename of cscope.out
location (usually the project root directory) will be used as the prefix
to construct an absolute path. The default is off. Note: This option is
only effective when cscope (cscopeprg) is initialized without a prefix
path (-P).
*cscopetagorder* *csto*
The value of 'csto' determines the order in which |:cstag| performs a search.
If 'csto' is set to zero, cscope database(s) are searched first, followed
by tag file(s) if cscope did not return any matches. If 'csto' is set to
one, tag file(s) are searched before cscope database(s). The default is zero.
*cscopepathcomp* *cspc*
'cscopepathcomp' determines how many components of a file's path to display.
With the default value of zero the entire path will be displayed.
The value one will display only the filename with no path. Other values
display that many components. For example: >
:set cscopepathcomp=3
will display the last 3 components of the file's path, including the file
name itself.
==============================================================================
Using cscope in Nvim *cscope-usage* *cscope-howtouse*
To get started, build the cscope database in your project root directory: >
cscope -bcqR
See the cscope manpage for details: >
:Man cscope
By default the cscope database file is named "cscope.out". After building the
database, connect to it from Nvim: >
:cscope add cscope.out
That establishes a cscope connection for Nvim to use. You can check the
result with ":cs show". It will show something like:
# pid database name prepend path
0 28806 cscope.out <none>
Once a cscope connection is established, you can make queries to cscope and
the results will be printed. Queries are made using the command ":cs find".
For example: >
:cs find g ALIGN_SIZE
To make this easier you can configure mappings, see |cscope-suggestions|.
If the results return only one match, you will automatically be taken to it.
If there is more than one match, you will be given a selection screen to pick
the match you want to go to. After you have jumped to the new location,
simply hit Ctrl-T to get back to the previous one.
==============================================================================
Limitations *cscope-limitations*
Hard-coded limitation: doing a |:tjump| when |:cstag| searches the tag files
is not configurable (e.g., you can't do a tselect instead).
==============================================================================
Sample config *cscope-suggestions*
Copy this into your init.vim (adjust paths for your system): >
if has("cscope")
set csprg=/usr/local/bin/cscope
set csto=0
set cst
" add any database in current directory
if filereadable("cscope.out")
silent cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
silent cs add $CSCOPE_DB
endif
endif
By setting 'cscopetag', we have effectively replaced all instances of the :tag
command with :cstag. This includes :tag, Ctrl-], and "vim -t". In doing
this, the regular tag command not only searches your ctags generated tag
files, but your cscope databases as well.
Some users may want to keep the regular tag behavior and have a different
shortcut to access :cstag. For example, one could map Ctrl-_ (underscore)
to :cstag with the following command: >
map <C-_> :cstag <C-R>=expand("<cword>")<CR><CR>
A couple of very commonly used cscope queries (using ":cs find") is to
find all functions calling a certain function and to find all occurrences
of a particular C symbol. To do this, you can use these mappings as an
example: >
map g<C-]> :cs find 3 <C-R>=expand("<cword>")<CR><CR>
map g<C-\> :cs find 0 <C-R>=expand("<cword>")<CR><CR>
These mappings for Ctrl-] (right bracket) and Ctrl-\ (backslash) allow you to
place your cursor over the function name or C symbol and quickly query cscope
for any matches.
Or you may use the following scheme, inspired by Vim/Cscope tutorial from
Cscope Home Page (http://cscope.sourceforge.net/): >
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>a :cs find a <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
" the new window.
nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>a :scs find a <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one
nmap <C-Space><C-Space>s
\:vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>g
\:vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>c
\:vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>t
\:vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>e
\:vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>i
\:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space><C-Space>d
\:vert scs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>a
\:vert scs find a <C-R>=expand("<cword>")<CR><CR>
<
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@ -1250,8 +1250,6 @@ tag command action ~
|:cpfile| :cpf[ile] go to last error in previous file |:cpfile| :cpf[ile] go to last error in previous file
|:cquit| :cq[uit] quit Vim with an error code |:cquit| :cq[uit] quit Vim with an error code
|:crewind| :cr[ewind] go to the specified error, default first one |:crewind| :cr[ewind] go to the specified error, default first one
|:cscope| :cs[cope] execute cscope command
|:cstag| :cst[ag] use cscope to jump to a tag
|:cunmap| :cu[nmap] like ":unmap" but for Command-line mode |:cunmap| :cu[nmap] like ":unmap" but for Command-line mode
|:cunabbrev| :cuna[bbrev] like ":unabbrev" but for Command-line mode |:cunabbrev| :cuna[bbrev] like ":unabbrev" but for Command-line mode
|:cunmenu| :cunme[nu] remove menu for Command-line mode |:cunmenu| :cunme[nu] remove menu for Command-line mode
@ -1375,7 +1373,6 @@ tag command action ~
|:lcd| :lc[d] change directory locally |:lcd| :lc[d] change directory locally
|:lchdir| :lch[dir] change directory locally |:lchdir| :lch[dir] change directory locally
|:lclose| :lcl[ose] close location window |:lclose| :lcl[ose] close location window
|:lcscope| :lcs[cope] like ":cscope" but uses location list
|:ldo| :ld[o] execute command in valid location list entries |:ldo| :ld[o] execute command in valid location list entries
|:lfdo| :lfd[o] execute command in each file in location list |:lfdo| :lfd[o] execute command in each file in location list
|:left| :le[ft] left align lines |:left| :le[ft] left align lines
@ -1556,7 +1553,6 @@ tag command action ~
buffer list buffer list
|:scriptnames| :scr[iptnames] list names of all sourced Vim scripts |:scriptnames| :scr[iptnames] list names of all sourced Vim scripts
|:scriptencoding| :scripte[ncoding] encoding used in sourced Vim script |:scriptencoding| :scripte[ncoding] encoding used in sourced Vim script
|:scscope| :scs[cope] split window and execute cscope command
|:set| :se[t] show or set options |:set| :se[t] show or set options
|:setfiletype| :setf[iletype] set 'filetype', unless it was set already |:setfiletype| :setf[iletype] set 'filetype', unless it was set already
|:setglobal| :setg[lobal] show global values of options |:setglobal| :setg[lobal] show global values of options

View File

@ -1336,7 +1336,6 @@ completion can be enabled:
-complete=color color schemes -complete=color color schemes
-complete=command Ex command (and arguments) -complete=command Ex command (and arguments)
-complete=compiler compilers -complete=compiler compilers
-complete=cscope |:cscope| suboptions
-complete=dir directory names -complete=dir directory names
-complete=environment environment variable names -complete=environment environment variable names
-complete=event autocommand events -complete=event autocommand events

View File

@ -13,6 +13,27 @@ BREAKING CHANGES *news-breaking*
The following changes may require adaptations in user config or plugins. The following changes may require adaptations in user config or plugins.
Cscope is now removed (see |cscope| and |nvim-features-removed|):
- Commands removed:
- `:cscope`
- `:lcscope`
- `:scscope`
- `:cstag`
- Options removed:
- `cscopepathcomp`
- `cscopeprg`
- `cscopequickfix`
- `cscoperelative`
- `cscopetag`
- `cscopetagorder`
- `cscopeverbose`
- Eval functions removed:
- `cscope_connection()`
Note: support for |ctags| remains with no plans to remove.
See https://github.com/neovim/neovim/pull/20545 for more information.
============================================================================== ==============================================================================
NEW FEATURES *news-features* NEW FEATURES *news-features*

View File

@ -1792,43 +1792,6 @@ A jump table for the options with a short description can be found at |Q_op|.
_ When using |cw| on a word, do not include the _ When using |cw| on a word, do not include the
whitespace following the word in the motion. whitespace following the word in the motion.
*'cscopepathcomp'* *'cspc'*
'cscopepathcomp' 'cspc' number (default 0)
global
Determines how many components of the path to show in a list of tags.
See |cscopepathcomp|.
*'cscopeprg'* *'csprg'*
'cscopeprg' 'csprg' string (default "cscope")
global
Specifies the command to execute cscope. See |cscopeprg|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'cscopequickfix'* *'csqf'*
'cscopequickfix' 'csqf' string (default "")
global
Specifies whether to use quickfix window to show cscope results.
See |cscopequickfix|.
*'cscoperelative'* *'csre'* *'nocscoperelative'* *'nocsre'*
'cscoperelative' 'csre' boolean (default off)
global
In the absence of a prefix (-P) for cscope. setting this option enables
to use the basename of cscope.out path as the prefix.
See |cscoperelative|.
*'cscopetag'* *'cst'* *'nocscopetag'* *'nocst'*
'cscopetag' 'cst' boolean (default off)
global
Use cscope for tag commands. See |cscope-options|.
*'cscopetagorder'* *'csto'*
'cscopetagorder' 'csto' number (default 0)
global
Determines the order in which ":cstag" performs a search. See
|cscopetagorder|.
*'cursorbind'* *'crb'* *'nocursorbind'* *'nocrb'* *'cursorbind'* *'crb'* *'nocursorbind'* *'nocrb'*
'cursorbind' 'crb' boolean (default off) 'cursorbind' 'crb' boolean (default off)
local to window local to window

View File

@ -673,12 +673,6 @@ Short explanation of each option: *option-list*
'confirm' 'cf' ask what to do about unsaved/read-only files 'confirm' 'cf' ask what to do about unsaved/read-only files
'copyindent' 'ci' make 'autoindent' use existing indent structure 'copyindent' 'ci' make 'autoindent' use existing indent structure
'cpoptions' 'cpo' flags for Vi-compatible behavior 'cpoptions' 'cpo' flags for Vi-compatible behavior
'cscopepathcomp' 'cspc' how many components of the path to show
'cscopeprg' 'csprg' command to execute cscope
'cscopequickfix' 'csqf' use quickfix window for cscope results
'cscoperelative' 'csre' Use cscope.out path basename as prefix
'cscopetag' 'cst' use cscope for tag commands
'cscopetagorder' 'csto' determines ":cstag" search order
'cursorbind' 'crb' move cursor in window as it moves in other windows 'cursorbind' 'crb' move cursor in window as it moves in other windows
'cursorcolumn' 'cuc' highlight the screen column of the cursor 'cursorcolumn' 'cuc' highlight the screen column of the cursor
'cursorline' 'cul' highlight the screen line of the cursor 'cursorline' 'cul' highlight the screen line of the cursor

View File

@ -268,9 +268,6 @@ doesn't work if the tags file isn't sorted.
The 'taglength' option can be used to tell Vim the number of significant The 'taglength' option can be used to tell Vim the number of significant
characters in a tag. characters in a tag.
Cscope is a free program. It does not only find places where an identifier is
declared, but also where it is used. See |cscope|.
============================================================================== ==============================================================================
*29.2* The preview window *29.2* The preview window

View File

@ -1051,7 +1051,6 @@ Various: *various-functions*
exists() check if a variable, function, etc. exists exists() check if a variable, function, etc. exists
has() check if a feature is supported in Vim has() check if a feature is supported in Vim
changenr() return number of most recent change changenr() return number of most recent change
cscope_connection() check if a cscope connection exists
did_filetype() check if a FileType autocommand was used did_filetype() check if a FileType autocommand was used
eventhandler() check if invoked by an event handler eventhandler() check if invoked by an event handler
getpid() get process ID of Vim getpid() get process ID of Vim

View File

@ -36,7 +36,6 @@ centralized reference of the differences.
- 'belloff' defaults to "all" - 'belloff' defaults to "all"
- 'compatible' is always disabled - 'compatible' is always disabled
- 'complete' excludes "i" - 'complete' excludes "i"
- 'cscopeverbose' is enabled
- 'directory' defaults to ~/.local/state/nvim/swap// (|xdg|), auto-created - 'directory' defaults to ~/.local/state/nvim/swap// (|xdg|), auto-created
- 'display' defaults to "lastline" - 'display' defaults to "lastline"
- 'encoding' is UTF-8 (cf. 'fileencoding' for file-content encoding) - 'encoding' is UTF-8 (cf. 'fileencoding' for file-content encoding)
@ -541,6 +540,10 @@ Commands:
:sleep! (does not hide the cursor; same as :sleep) :sleep! (does not hide the cursor; same as :sleep)
:smile :smile
:tearoff :tearoff
:cstag
:cscope
:lcscope
:scscope
Compile-time features: Compile-time features:
Emacs tags support Emacs tags support
@ -548,6 +551,7 @@ Compile-time features:
Eval: Eval:
Vim9script Vim9script
*cscope_connection()*
*js_encode()* *js_encode()*
*js_decode()* *js_decode()*
*v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead. *v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead.
@ -579,6 +583,13 @@ Options:
*'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".) *'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".)
'cpoptions' (gjkHw<*- and all POSIX flags were removed) 'cpoptions' (gjkHw<*- and all POSIX flags were removed)
*'cryptmethod'* *'cm'* *'key'* (Vim encryption implementation) *'cryptmethod'* *'cm'* *'key'* (Vim encryption implementation)
cscopepathcomp
cscopeprg
cscopequickfix
cscoperelative
cscopetag
cscopetagorder
cscopeverbose
*'ed'* *'edcompatible'* *'noed'* *'noedcompatible'* *'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
'encoding' ("utf-8" is always used) 'encoding' ("utf-8" is always used)
esckeys esckeys
@ -694,5 +705,9 @@ TUI:
at how the terminal is sending CSI. Nvim does not issue such a sequence and at how the terminal is sending CSI. Nvim does not issue such a sequence and
always uses 7-bit control sequences. always uses 7-bit control sequences.
Cscope:
*cscope*
Cscope has been removed in favour of LSP based solutions.
============================================================================== ==============================================================================
vim:tw=78:ts=8:sw=2:et:ft=help:norl: vim:tw=78:ts=8:sw=2:et:ft=help:norl:

View File

@ -604,11 +604,6 @@ function M.goto_tag(pattern, _, _)
end end
end end
if vim.o.cscopetag then
-- return only a single entry so we work well with :cstag (#11675)
structured = { structured[1] }
end
return vim.tbl_map(function(entry) return vim.tbl_map(function(entry)
return { return {
name = entry.name, name = entry.name,

View File

@ -319,22 +319,6 @@ if has("eval")
call append("$", "\t(local to buffer)") call append("$", "\t(local to buffer)")
call <SID>OptionL("tfu") call <SID>OptionL("tfu")
endif endif
if has("cscope")
call append("$", "cscopeprg\tcommand for executing cscope")
call <SID>OptionG("csprg", &csprg)
call append("$", "cscopetag\tuse cscope for tag commands")
call <SID>BinOptionG("cst", &cst)
call append("$", "cscopetagorder\t0 or 1; the order in which \":cstag\" performs a search")
call append("$", " \tset csto=" . &csto)
call append("$", "cscopeverbose\tgive messages when adding a cscope database")
call <SID>BinOptionG("csverb", &csverb)
call append("$", "cscopepathcomp\thow many components of the path to show")
call append("$", " \tset cspc=" . &cspc)
call append("$", "cscopequickfix\twhen to open a quickfix window for cscope")
call <SID>OptionG("csqf", &csqf)
call append("$", "cscoperelative\tfile names in a cscope file are relative to that file")
call <SID>BinOptionG("csre", &csre)
endif
call <SID>Header("displaying text") call <SID>Header("displaying text")

View File

@ -192,11 +192,11 @@ preprocess_patch() {
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/\<\%('"${na_files}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/\<\%('"${na_files}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove *.proto, Make*, INSTALL*, gui_*, beval.*, some if_*, gvim, libvterm, tee, VisVim, xpm, xxd # Remove *.proto, Make*, INSTALL*, gui_*, beval.*, some if_*, gvim, libvterm, tee, VisVim, xpm, xxd
local na_src='auto\|configure.*\|GvimExt\|libvterm\|proto\|tee\|VisVim\|xpm\|xxd\|Make.*\|INSTALL.*\|beval.*\|gui.*\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv' local na_src='auto\|configure.*\|GvimExt\|libvterm\|proto\|tee\|VisVim\|xpm\|xxd\|Make.*\|INSTALL.*\|beval.*\|gui.*\|if_cscop\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@<!\%('"${na_src}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@<!\%('"${na_src}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove unwanted Vim doc files. # Remove unwanted Vim doc files.
local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|term\.txt\|todo\.txt\|version\d\.txt\|vim9\.txt\|sponsor\.txt\|intro\.txt\|tags' local na_doc='channel\.txt\|if_cscop\.txt\|netbeans\.txt\|os_\w\+\.txt\|term\.txt\|todo\.txt\|version\d\.txt\|vim9\.txt\|sponsor\.txt\|intro\.txt\|tags'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\<\%('"${na_doc}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\<\%('"${na_doc}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove "Last change ..." changes in doc files. # Remove "Last change ..." changes in doc files.
@ -207,7 +207,7 @@ preprocess_patch() {
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove testdir/test_*.vim files # Remove testdir/test_*.vim files
local na_src_testdir='balloon.*\|channel.*\|crypt\.vim\|gui.*\|job_fails\.vim\|json\.vim\|mzscheme\.vim\|netbeans.*\|paste\.vim\|popupwin.*\|restricted\.vim\|shortpathname\.vim\|tcl\.vim\|terminal.*\|xxd\.vim' local na_src_testdir='balloon.*\|channel.*\|crypt\.vim\|cscope\.vim\|gui.*\|job_fails\.vim\|json\.vim\|mzscheme\.vim\|netbeans.*\|paste\.vim\|popupwin.*\|restricted\.vim\|shortpathname\.vim\|tcl\.vim\|terminal.*\|xxd\.vim'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<test_\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<test_\%('"${na_src_testdir}"'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove version.c #7555 # Remove version.c #7555

View File

@ -22,7 +22,6 @@
#include "nvim/getchar.h" #include "nvim/getchar.h"
#include "nvim/help.h" #include "nvim/help.h"
#include "nvim/highlight_group.h" #include "nvim/highlight_group.h"
#include "nvim/if_cscope.h"
#include "nvim/locale.h" #include "nvim/locale.h"
#include "nvim/lua/executor.h" #include "nvim/lua/executor.h"
#include "nvim/mapping.h" #include "nvim/mapping.h"
@ -1419,11 +1418,6 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
case CMD_highlight: case CMD_highlight:
set_context_in_highlight_cmd(xp, arg); set_context_in_highlight_cmd(xp, arg);
break; break;
case CMD_cscope:
case CMD_lcscope:
case CMD_scscope:
set_context_in_cscope_cmd(xp, arg, cmdidx);
break;
case CMD_sign: case CMD_sign:
set_context_in_sign_cmd(xp, (char *)arg); set_context_in_sign_cmd(xp, (char *)arg);
break; break;
@ -2063,7 +2057,6 @@ static int ExpandOther(expand_T *xp, regmatch_T *rmp, int *num_file, char ***fil
{ EXPAND_HIGHLIGHT, (ExpandFunc)get_highlight_name, true, false }, { EXPAND_HIGHLIGHT, (ExpandFunc)get_highlight_name, true, false },
{ EXPAND_EVENTS, expand_get_event_name, true, false }, { EXPAND_EVENTS, expand_get_event_name, true, false },
{ EXPAND_AUGROUP, expand_get_augroup_name, true, false }, { EXPAND_AUGROUP, expand_get_augroup_name, true, false },
{ EXPAND_CSCOPE, get_cscope_name, true, true },
{ EXPAND_SIGN, get_sign_name, true, true }, { EXPAND_SIGN, get_sign_name, true, true },
{ EXPAND_PROFILE, get_profile_name, true, true }, { EXPAND_PROFILE, get_profile_name, true, true },
#ifdef HAVE_WORKING_LIBINTL #ifdef HAVE_WORKING_LIBINTL
@ -2883,11 +2876,6 @@ void f_getcompletion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
xpc.xp_pattern_len = strlen(xpc.xp_pattern); xpc.xp_pattern_len = strlen(xpc.xp_pattern);
} }
if (xpc.xp_context == EXPAND_CSCOPE) {
set_context_in_cscope_cmd(&xpc, (const char *)xpc.xp_pattern, CMD_cscope);
xpc.xp_pattern_len = strlen(xpc.xp_pattern);
}
if (xpc.xp_context == EXPAND_SIGN) { if (xpc.xp_context == EXPAND_SIGN) {
set_context_in_sign_cmd(&xpc, xpc.xp_pattern); set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
xpc.xp_pattern_len = strlen(xpc.xp_pattern); xpc.xp_pattern_len = strlen(xpc.xp_pattern);

View File

@ -88,7 +88,6 @@ return {
cos={args=1, base=1, float_func="cos"}, cos={args=1, base=1, float_func="cos"},
cosh={args=1, base=1, float_func="cosh"}, cosh={args=1, base=1, float_func="cosh"},
count={args={2, 4}, base=1}, count={args={2, 4}, base=1},
cscope_connection={args={0, 3}},
ctxget={args={0, 1}}, ctxget={args={0, 1}},
ctxpop={}, ctxpop={},
ctxpush={args={0, 1}}, ctxpush={args={0, 1}},

View File

@ -39,7 +39,6 @@
#include "nvim/getchar.h" #include "nvim/getchar.h"
#include "nvim/globals.h" #include "nvim/globals.h"
#include "nvim/highlight_group.h" #include "nvim/highlight_group.h"
#include "nvim/if_cscope.h"
#include "nvim/indent.h" #include "nvim/indent.h"
#include "nvim/indent_c.h" #include "nvim/indent_c.h"
#include "nvim/input.h" #include "nvim/input.h"
@ -1132,29 +1131,6 @@ static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
rettv->vval.v_number = n; rettv->vval.v_number = n;
} }
/// "cscope_connection([{num} , {dbpath} [, {prepend}]])" function
///
/// Checks the existence of a cscope connection.
static void f_cscope_connection(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
int num = 0;
const char *dbpath = NULL;
const char *prepend = NULL;
char buf[NUMBUFLEN];
if (argvars[0].v_type != VAR_UNKNOWN
&& argvars[1].v_type != VAR_UNKNOWN) {
num = (int)tv_get_number(&argvars[0]);
dbpath = tv_get_string(&argvars[1]);
if (argvars[2].v_type != VAR_UNKNOWN) {
prepend = tv_get_string_buf(&argvars[2], buf);
}
}
rettv->vval.v_number = cs_connection(num, (char_u *)dbpath,
(char_u *)prepend);
}
/// "ctxget([{index}])" function /// "ctxget([{index}])" function
static void f_ctxget(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) static void f_ctxget(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{ {
@ -3565,7 +3541,6 @@ static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
"cmdwin", "cmdwin",
"comments", "comments",
"conceal", "conceal",
"cscope",
"cursorbind", "cursorbind",
"cursorshape", "cursorshape",
#ifdef DEBUG #ifdef DEBUG

View File

@ -672,18 +672,6 @@ module.cmds = {
addr_type='ADDR_UNSIGNED', addr_type='ADDR_UNSIGNED',
func='ex_cc', func='ex_cc',
}, },
{
command='cscope',
flags=bit.bor(EXTRA, NOTRLCOM, XFILE),
addr_type='ADDR_NONE',
func='ex_cscope',
},
{
command='cstag',
flags=bit.bor(BANG, TRLBAR, WORD1),
addr_type='ADDR_NONE',
func='ex_cstag',
},
{ {
command='cunmap', command='cunmap',
flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, CTRLV, CMDWIN, LOCK_OK), flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, CTRLV, CMDWIN, LOCK_OK),
@ -1404,12 +1392,6 @@ module.cmds = {
addr_type='ADDR_OTHER', addr_type='ADDR_OTHER',
func='ex_cclose', func='ex_cclose',
}, },
{
command='lcscope',
flags=bit.bor(EXTRA, NOTRLCOM, XFILE),
addr_type='ADDR_NONE',
func='ex_cscope',
},
{ {
command='ldo', command='ldo',
flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM, RANGE, DFLALL), flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM, RANGE, DFLALL),
@ -2421,12 +2403,6 @@ module.cmds = {
addr_type='ADDR_NONE', addr_type='ADDR_NONE',
func='ex_scriptencoding', func='ex_scriptencoding',
}, },
{
command='scscope',
flags=bit.bor(EXTRA, NOTRLCOM),
addr_type='ADDR_NONE',
func='ex_scscope',
},
{ {
command='set', command='set',
flags=bit.bor(BANG, TRLBAR, EXTRA, CMDWIN, LOCK_OK, SBOXOK), flags=bit.bor(BANG, TRLBAR, EXTRA, CMDWIN, LOCK_OK, SBOXOK),

View File

@ -44,7 +44,6 @@
#include "nvim/hardcopy.h" #include "nvim/hardcopy.h"
#include "nvim/help.h" #include "nvim/help.h"
#include "nvim/highlight_group.h" #include "nvim/highlight_group.h"
#include "nvim/if_cscope.h"
#include "nvim/input.h" #include "nvim/input.h"
#include "nvim/keycodes.h" #include "nvim/keycodes.h"
#include "nvim/locale.h" #include "nvim/locale.h"
@ -6589,10 +6588,6 @@ static void ex_tag_cmd(exarg_T *eap, char *name)
cmd = DT_LAST; // ":tlast" cmd = DT_LAST; // ":tlast"
break; break;
default: // ":tag" default: // ":tag"
if (p_cst && *eap->arg != NUL) {
ex_cstag(eap);
return;
}
cmd = DT_TAG; cmd = DT_TAG;
break; break;
} }

View File

@ -182,8 +182,7 @@ Additionally uses the following environment variables:
If set to 1 then all generated declarations receive a comment with file If set to 1 then all generated declarations receive a comment with file
name and line number after the declaration. This may be useful for name and line number after the declaration. This may be useful for
debugging gen_declarations script, but not much beyond that with debugging gen_declarations script, but not much beyond that with
configured development environment (i.e. with ctags/cscope/finding configured development environment (i.e. with with clang/etc).
definitions with clang/etc).
WARNING: setting this to 1 will cause extensive rebuilds: declarations WARNING: setting this to 1 will cause extensive rebuilds: declarations
generator script will not regenerate non-static.h file if its generator script will not regenerate non-static.h file if its

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
#ifndef NVIM_IF_CSCOPE_H
#define NVIM_IF_CSCOPE_H
#include "nvim/ex_cmds_defs.h" // for exarg_T
#include "nvim/types.h" // for char_u and expand_T
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "if_cscope.h.generated.h"
#endif
#endif // NVIM_IF_CSCOPE_H

View File

@ -1,64 +0,0 @@
#ifndef NVIM_IF_CSCOPE_DEFS_H
#define NVIM_IF_CSCOPE_DEFS_H
// CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com>
// Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com>
//
// The basic idea/structure of cscope for Vim was borrowed from Nvi.
// There might be a few lines of code that look similar to what Nvi
// has. If this is a problem and requires inclusion of the annoying
// BSD license, then sue me; I'm not worth much anyway.
#if defined(UNIX)
# include <sys/types.h> // pid_t
#endif
#include "nvim/ex_cmds_defs.h"
#include "nvim/os/fs_defs.h"
#include "nvim/os/os_defs.h"
#define CSCOPE_SUCCESS 0
#define CSCOPE_FAILURE -1
#define CSCOPE_DBFILE "cscope.out"
#define CSCOPE_PROMPT ">> "
// See ":help cscope-find" for the possible queries.
typedef struct {
char *name;
int (*func)(exarg_T *eap);
char *help;
char *usage;
int cansplit; // if supports splitting window
} cscmd_T;
typedef struct csi {
char *fname; // cscope db name
char *ppath; // path to prepend (the -P option)
char *flags; // additional cscope flags/options (e.g, -p2)
#if defined(UNIX)
pid_t pid; // PID of the connected cscope process
#else
DWORD pid; // PID of the connected cscope process
HANDLE hProc; // cscope process handle
DWORD nVolume; // Volume serial number, instead of st_dev
DWORD nIndexHigh; // st_ino has no meaning on Windows
DWORD nIndexLow;
#endif
FileID file_id;
FILE *fr_fp; // from cscope: FILE.
FILE *to_fp; // to cscope: FILE.
} csinfo_T;
typedef enum { Add, Find, Help, Kill, Reset, Show, } csid_e;
typedef enum {
Store,
Get,
Free,
Print,
} mcmd_e;
#endif // NVIM_IF_CSCOPE_DEFS_H

View File

@ -31,7 +31,6 @@
#include "nvim/highlight.h" #include "nvim/highlight.h"
#include "nvim/highlight_group.h" #include "nvim/highlight_group.h"
#include "nvim/iconv.h" #include "nvim/iconv.h"
#include "nvim/if_cscope.h"
#include "nvim/insexpand.h" #include "nvim/insexpand.h"
#include "nvim/locale.h" #include "nvim/locale.h"
#include "nvim/log.h" #include "nvim/log.h"
@ -772,7 +771,6 @@ void getout(int exitval)
ui_call_set_title(cstr_as_string((char *)p_titleold)); ui_call_set_title(cstr_as_string((char *)p_titleold));
} }
cs_end();
if (garbage_collect_at_exit) { if (garbage_collect_at_exit) {
garbage_collect(false); garbage_collect(false);
} }

View File

@ -4313,11 +4313,7 @@ static void nv_ident(cmdarg_T *cap)
case ']': case ']':
tag_cmd = true; tag_cmd = true;
if (p_cst) {
STRCPY(buf, "cstag ");
} else {
STRCPY(buf, "ts "); STRCPY(buf, "ts ");
}
break; break;
default: default:

View File

@ -471,15 +471,6 @@ EXTERN long p_ph; // 'pumheight'
EXTERN long p_pw; // 'pumwidth' EXTERN long p_pw; // 'pumwidth'
EXTERN char *p_com; ///< 'comments' EXTERN char *p_com; ///< 'comments'
EXTERN char *p_cpo; // 'cpoptions' EXTERN char *p_cpo; // 'cpoptions'
EXTERN char *p_csprg; // 'cscopeprg'
EXTERN int p_csre; // 'cscoperelative'
EXTERN char *p_csqf; // 'cscopequickfix'
#define CSQF_CMDS "sgdctefia"
#define CSQF_FLAGS "+-0"
EXTERN int p_cst; // 'cscopetag'
EXTERN long p_csto; // 'cscopetagorder'
EXTERN long p_cspc; // 'cscopepathcomp'
EXTERN int p_csverbose; // 'cscopeverbose'
EXTERN char *p_debug; // 'debug' EXTERN char *p_debug; // 'debug'
EXTERN char *p_def; // 'define' EXTERN char *p_def; // 'define'
EXTERN char *p_inc; EXTERN char *p_inc;

View File

@ -495,58 +495,6 @@ return {
varname='p_cpo', varname='p_cpo',
defaults={if_true=macros('CPO_VIM')} defaults={if_true=macros('CPO_VIM')}
}, },
{
full_name='cscopepathcomp', abbreviation='cspc',
short_desc=N_("how many components of the path to show"),
type='number', scope={'global'},
varname='p_cspc',
defaults={if_true=0}
},
{
full_name='cscopeprg', abbreviation='csprg',
short_desc=N_("command to execute cscope"),
type='string', scope={'global'},
secure=true,
expand=true,
varname='p_csprg',
defaults={if_true="cscope"}
},
{
full_name='cscopequickfix', abbreviation='csqf',
short_desc=N_("use quickfix window for cscope results"),
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_csqf',
defaults={if_true=""}
},
{
full_name='cscoperelative', abbreviation='csre',
short_desc=N_("Use cscope.out path basename as prefix"),
type='bool', scope={'global'},
varname='p_csre',
defaults={if_true=0}
},
{
full_name='cscopetag', abbreviation='cst',
short_desc=N_("use cscope for tag commands"),
type='bool', scope={'global'},
varname='p_cst',
defaults={if_true=0}
},
{
full_name='cscopetagorder', abbreviation='csto',
short_desc=N_("determines \":cstag\" search order"),
type='number', scope={'global'},
varname='p_csto',
defaults={if_true=0}
},
{
full_name='cscopeverbose', abbreviation='csverb',
short_desc=N_("give messages when adding a cscope database"),
type='bool', scope={'global'},
varname='p_csverbose',
defaults={if_true=1}
},
{ {
full_name='cursorbind', abbreviation='crb', full_name='cursorbind', abbreviation='crb',
short_desc=N_("move cursor in window as it moves in other windows"), short_desc=N_("move cursor in window as it moves in other windows"),

View File

@ -1375,23 +1375,6 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
coladvance(curwin->w_virtcol); coladvance(curwin->w_virtcol);
} }
} }
} else if (varp == &p_csqf) {
if (p_csqf != NULL) {
p = p_csqf;
while (*p != NUL) {
if (vim_strchr(CSQF_CMDS, *p) == NULL
|| p[1] == NUL
|| vim_strchr(CSQF_FLAGS, p[1]) == NULL
|| (p[2] != NUL && p[2] != ',')) {
errmsg = e_invarg;
break;
} else if (p[2] == NUL) {
break;
} else {
p += 3;
}
}
}
} else if (gvarp == &p_cino) { // 'cinoptions' } else if (gvarp == &p_cino) { // 'cinoptions'
// TODO(vim): recognize errors // TODO(vim): recognize errors
parse_cino(curbuf); parse_cino(curbuf);

View File

@ -24,7 +24,6 @@
#include "nvim/fold.h" #include "nvim/fold.h"
#include "nvim/garray.h" #include "nvim/garray.h"
#include "nvim/help.h" #include "nvim/help.h"
#include "nvim/if_cscope.h"
#include "nvim/input.h" #include "nvim/input.h"
#include "nvim/insexpand.h" #include "nvim/insexpand.h"
#include "nvim/mark.h" #include "nvim/mark.h"
@ -132,16 +131,13 @@ static int tfu_in_use = false; // disallow recursive call of tagfunc
/// type == DT_LAST: jump to last match of same tag /// type == DT_LAST: jump to last match of same tag
/// type == DT_SELECT: ":tselect [tag]", select tag from a list of all matches /// type == DT_SELECT: ":tselect [tag]", select tag from a list of all matches
/// type == DT_JUMP: ":tjump [tag]", jump to tag or select tag from a list /// type == DT_JUMP: ":tjump [tag]", jump to tag or select tag from a list
/// type == DT_CSCOPE: use cscope to find the tag
/// type == DT_LTAG: use location list for displaying tag matches /// type == DT_LTAG: use location list for displaying tag matches
/// type == DT_FREE: free cached matches /// type == DT_FREE: free cached matches
/// ///
/// for cscope, returns true if we jumped to tag or aborted, false otherwise
///
/// @param tag tag (pattern) to jump to /// @param tag tag (pattern) to jump to
/// @param forceit :ta with ! /// @param forceit :ta with !
/// @param verbose print "tag not found" message /// @param verbose print "tag not found" message
bool do_tag(char *tag, int type, int count, int forceit, int verbose) void do_tag(char *tag, int type, int count, int forceit, int verbose)
{ {
taggy_T *tagstack = curwin->w_tagstack; taggy_T *tagstack = curwin->w_tagstack;
int tagstackidx = curwin->w_tagstackidx; int tagstackidx = curwin->w_tagstackidx;
@ -158,7 +154,6 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
int error_cur_match = 0; int error_cur_match = 0;
int save_pos = false; int save_pos = false;
fmark_T saved_fmark; fmark_T saved_fmark;
bool jumped_to_tag = false;
int new_num_matches; int new_num_matches;
char **new_matches; char **new_matches;
int use_tagstack; int use_tagstack;
@ -174,16 +169,15 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
if (tfu_in_use) { if (tfu_in_use) {
emsg(_(recurmsg)); emsg(_(recurmsg));
return false; return;
} }
#ifdef EXITFREE #ifdef EXITFREE
if (type == DT_FREE) { if (type == DT_FREE) {
// remove the list of matches // remove the list of matches
FreeWild(num_matches, matches); FreeWild(num_matches, matches);
cs_free_tags();
num_matches = 0; num_matches = 0;
return false; return;
} }
#endif #endif
@ -219,8 +213,7 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
// new pattern, add to the tag stack // new pattern, add to the tag stack
if (*tag != NUL if (*tag != NUL
&& (type == DT_TAG || type == DT_SELECT || type == DT_JUMP && (type == DT_TAG || type == DT_SELECT || type == DT_JUMP
|| type == DT_LTAG || type == DT_LTAG)) {
|| type == DT_CSCOPE)) {
if (g_do_tagpreview != 0) { if (g_do_tagpreview != 0) {
if (ptag_entry.tagname != NULL if (ptag_entry.tagname != NULL
&& strcmp(ptag_entry.tagname, tag) == 0) { && strcmp(ptag_entry.tagname, tag) == 0) {
@ -311,7 +304,6 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
// remove the old list of matches // remove the old list of matches
FreeWild(num_matches, matches); FreeWild(num_matches, matches);
cs_free_tags();
num_matches = 0; num_matches = 0;
tag_freematch(); tag_freematch();
goto end_do_tag; goto end_do_tag;
@ -360,7 +352,6 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
cur_match = count - 1; break; cur_match = count - 1; break;
case DT_SELECT: case DT_SELECT:
case DT_JUMP: case DT_JUMP:
case DT_CSCOPE:
case DT_LAST: case DT_LAST:
cur_match = MAXCOL - 1; break; cur_match = MAXCOL - 1; break;
case DT_NEXT: case DT_NEXT:
@ -454,9 +445,6 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
flags = TAG_NOIC; flags = TAG_NOIC;
} }
if (type == DT_CSCOPE) {
flags = TAG_CSCOPE;
}
if (verbose) { if (verbose) {
flags |= TAG_VERBOSE; flags |= TAG_VERBOSE;
} }
@ -509,10 +497,7 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
} else { } else {
bool ask_for_selection = false; bool ask_for_selection = false;
if (type == DT_CSCOPE && num_matches > 1) { if (type == DT_TAG && *tag != NUL) {
cs_print_tags();
ask_for_selection = true;
} else if (type == DT_TAG && *tag != NUL) {
// If a count is supplied to the ":tag <name>" command, then // If a count is supplied to the ":tag <name>" command, then
// jump to count'th matching tag. // jump to count'th matching tag.
cur_match = count > 0 ? count - 1 : 0; cur_match = count > 0 ? count - 1 : 0;
@ -536,8 +521,6 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
tagstack[tagstackidx].fmark = saved_fmark; tagstack[tagstackidx].fmark = saved_fmark;
tagstackidx = prevtagstackidx; tagstackidx = prevtagstackidx;
} }
cs_free_tags();
jumped_to_tag = true;
break; break;
} }
cur_match = i - 1; cur_match = i - 1;
@ -586,7 +569,6 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
ic = (matches[cur_match][0] & MT_IC_OFF); ic = (matches[cur_match][0] & MT_IC_OFF);
if (type != DT_TAG && type != DT_SELECT && type != DT_JUMP if (type != DT_TAG && type != DT_SELECT && type != DT_JUMP
&& type != DT_CSCOPE
&& (num_matches > 1 || ic) && (num_matches > 1 || ic)
&& !skip_msg) { && !skip_msg) {
// Give an indication of the number of matching tags // Give an indication of the number of matching tags
@ -619,7 +601,7 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
set_vim_var_string(VV_SWAPCOMMAND, (char *)IObuff, -1); set_vim_var_string(VV_SWAPCOMMAND, (char *)IObuff, -1);
// Jump to the desired match. // Jump to the desired match.
i = jumpto_tag((char_u *)matches[cur_match], forceit, type != DT_CSCOPE); i = jumpto_tag((char_u *)matches[cur_match], forceit, true);
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
@ -649,7 +631,6 @@ bool do_tag(char *tag, int type, int count, int forceit, int verbose)
if (use_tagstack && tagstackidx > curwin->w_tagstacklen) { if (use_tagstack && tagstackidx > curwin->w_tagstacklen) {
tagstackidx = curwin->w_tagstackidx; tagstackidx = curwin->w_tagstackidx;
} }
jumped_to_tag = true;
} }
} }
break; break;
@ -663,7 +644,7 @@ end_do_tag:
postponed_split = 0; // don't split next time postponed_split = 0; // don't split next time
g_do_tagpreview = 0; // don't do tag preview next time g_do_tagpreview = 0; // don't do tag preview next time
return jumped_to_tag; return;
} }
// List all the matching tags. // List all the matching tags.
@ -1324,7 +1305,6 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
/// TAG_REGEXP use "pat" as a regexp /// TAG_REGEXP use "pat" as a regexp
/// TAG_NOIC don't always ignore case /// TAG_NOIC don't always ignore case
/// TAG_KEEP_LANG keep language /// TAG_KEEP_LANG keep language
/// TAG_CSCOPE use cscope results for tags
/// TAG_NO_TAGFUNC do not call the 'tagfunc' function /// TAG_NO_TAGFUNC do not call the 'tagfunc' function
/// ///
/// @param pat pattern to search for /// @param pat pattern to search for
@ -1409,7 +1389,6 @@ int find_tags(char *pat, int *num_matches, char ***matchesp, int flags, int minc
int name_only = (flags & TAG_NAMES); int name_only = (flags & TAG_NAMES);
int noic = (flags & TAG_NOIC); int noic = (flags & TAG_NOIC);
int get_it_again = false; int get_it_again = false;
int use_cscope = (flags & TAG_CSCOPE);
int verbose = (flags & TAG_VERBOSE); int verbose = (flags & TAG_VERBOSE);
int use_tfu = ((flags & TAG_NO_TAGFUNC) == 0); int use_tfu = ((flags & TAG_NO_TAGFUNC) == 0);
int save_p_ic = p_ic; int save_p_ic = p_ic;
@ -1448,15 +1427,9 @@ int find_tags(char *pat, int *num_matches, char ***matchesp, int flags, int minc
hash_init(&ht_match[mtt]); hash_init(&ht_match[mtt]);
} }
STRCPY(tag_fname, "from cscope"); // for error messages
// Initialize a few variables // Initialize a few variables
if (help_only) { // want tags from help file if (help_only) { // want tags from help file
curbuf->b_help = true; // will be restored later curbuf->b_help = true; // will be restored later
} else if (use_cscope) {
// Make sure we don't mix help and cscope, confuses Coverity.
help_only = false;
curbuf->b_help = false;
} }
orgpat.len = (int)strlen(pat); orgpat.len = (int)strlen(pat);
@ -1522,13 +1495,10 @@ int find_tags(char *pat, int *num_matches, char ***matchesp, int flags, int minc
// Try tag file names from tags option one by one. // Try tag file names from tags option one by one.
for (first_file = true; for (first_file = true;
use_cscope || get_tagfname(&tn, first_file, (char *)tag_fname) == OK; get_tagfname(&tn, first_file, (char *)tag_fname) == OK;
first_file = false) { first_file = false) {
// A file that doesn't exist is silently ignored. Only when not a // A file that doesn't exist is silently ignored. Only when not a
// single file is found, an error message is given (further on). // single file is found, an error message is given (further on).
if (use_cscope) {
fp = NULL; // avoid GCC warning
} else {
if (curbuf->b_help) { if (curbuf->b_help) {
// Keep en if the file extension is .txt // Keep en if the file extension is .txt
if (is_txt) { if (is_txt) {
@ -1592,7 +1562,7 @@ int find_tags(char *pat, int *num_matches, char ***matchesp, int flags, int minc
smsg(_("Searching tags file %s"), tag_fname); smsg(_("Searching tags file %s"), tag_fname);
verbose_leave(); verbose_leave();
} }
}
did_open = true; // remember that we found at least one file did_open = true; // remember that we found at least one file
state = TS_START; // we're at the start of the file state = TS_START; // we're at the start of the file
@ -1676,9 +1646,7 @@ int find_tags(char *pat, int *num_matches, char ***matchesp, int flags, int minc
// skip empty and blank lines // skip empty and blank lines
do { do {
eof = use_cscope eof = vim_fgets(lbuf, lbuf_size, fp);
? cs_fgets(lbuf, lbuf_size)
: vim_fgets(lbuf, lbuf_size, fp);
} while (!eof && vim_isblankline((char *)lbuf)); } while (!eof && vim_isblankline((char *)lbuf));
if (eof) { if (eof) {
@ -1745,8 +1713,7 @@ line_read_in:
// the tag file isn't sorted, the second loop will find it. // the tag file isn't sorted, the second loop will find it.
// When "!_TAG_FILE_SORTED" found: start binary search if // When "!_TAG_FILE_SORTED" found: start binary search if
// flag set. // flag set.
// For cscope, it's always linear. if (linear) {
if (linear || use_cscope) {
state = TS_LINEAR; state = TS_LINEAR;
} else if (tag_file_sorted == NUL) { } else if (tag_file_sorted == NUL) {
state = TS_BINARY; state = TS_BINARY;
@ -1797,7 +1764,7 @@ parse_line:
// last-but-one byte (see vim_fgets()). // last-but-one byte (see vim_fgets()).
// Has been reported for Mozilla JS with extremely long names. // Has been reported for Mozilla JS with extremely long names.
// In that case we need to increase lbuf_size. // In that case we need to increase lbuf_size.
if (lbuf[lbuf_size - 2] != NUL && !use_cscope) { if (lbuf[lbuf_size - 2] != NUL) {
lbuf_size *= 2; lbuf_size *= 2;
xfree(lbuf); xfree(lbuf);
lbuf = xmalloc((size_t)lbuf_size); lbuf = xmalloc((size_t)lbuf_size);
@ -1985,10 +1952,6 @@ parse_line:
if (match) { if (match) {
size_t len = 0; size_t len = 0;
if (use_cscope) {
// Don't change the ordering, always use the same table.
mtt = MT_GL_OTH;
} else {
// Decide in which array to store this match. // Decide in which array to store this match.
is_current = test_for_current((char *)tagp.fname, (char *)tagp.fname_end, is_current = test_for_current((char *)tagp.fname, (char *)tagp.fname_end,
(char *)tag_fname, (char *)tag_fname,
@ -2015,7 +1978,6 @@ parse_line:
if (match_re) { if (match_re) {
mtt += MT_RE_OFF; mtt += MT_RE_OFF;
} }
}
// Add the found match in ht_match[mtt] and ga_match[mtt]. // Add the found match in ht_match[mtt] and ga_match[mtt].
// Store the info we need later, which depends on the kind of // Store the info we need later, which depends on the kind of
@ -2098,16 +2060,11 @@ parse_line:
hashitem_T *hi; hashitem_T *hi;
// Don't add identical matches. // Don't add identical matches.
// Add all cscope tags, because they are all listed.
// "mfp" is used as a hash key, there is a NUL byte to end // "mfp" is used as a hash key, there is a NUL byte to end
// the part that matters for comparing, more bytes may // the part that matters for comparing, more bytes may
// follow after it. E.g. help tags store the priority // follow after it. E.g. help tags store the priority
// after the NUL. // after the NUL.
if (use_cscope) {
hash++;
} else {
hash = hash_hash((char_u *)mfp); hash = hash_hash((char_u *)mfp);
}
hi = hash_lookup(&ht_match[mtt], (const char *)mfp, hi = hash_lookup(&ht_match[mtt], (const char *)mfp,
strlen(mfp), hash); strlen(mfp), hash);
if (HASHITEM_EMPTY(hi)) { if (HASHITEM_EMPTY(hi)) {
@ -2121,23 +2078,16 @@ parse_line:
} }
} }
} }
if (use_cscope && eof) {
break;
}
} // forever } // forever
if (line_error) { if (line_error) {
semsg(_("E431: Format error in tags file \"%s\""), tag_fname); semsg(_("E431: Format error in tags file \"%s\""), tag_fname);
if (!use_cscope) {
semsg(_("Before byte %" PRId64), (int64_t)vim_ftell(fp)); semsg(_("Before byte %" PRId64), (int64_t)vim_ftell(fp));
}
stop_searching = true; stop_searching = true;
line_error = false; line_error = false;
} }
if (!use_cscope) {
fclose(fp); fclose(fp);
}
if (vimconv.vc_type != CONV_NONE) { if (vimconv.vc_type != CONV_NONE) {
convert_setup(&vimconv, NULL, NULL); convert_setup(&vimconv, NULL, NULL);
} }
@ -2154,23 +2104,18 @@ parse_line:
stop_searching = true; stop_searching = true;
} }
if (stop_searching || use_cscope) { if (stop_searching) {
break; break;
} }
} // end of for-each-file loop } // end of for-each-file loop
if (!use_cscope) {
tagname_free(&tn); tagname_free(&tn);
}
// stop searching when already did a linear search, or when TAG_NOIC // stop searching when already did a linear search, or when TAG_NOIC
// used, and 'ignorecase' not set or already did case-ignore search // used, and 'ignorecase' not set or already did case-ignore search
if (stop_searching || linear || (!p_ic && noic) || orgpat.regmatch.rm_ic) { if (stop_searching || linear || (!p_ic && noic) || orgpat.regmatch.rm_ic) {
break; break;
} }
if (use_cscope) {
break;
}
orgpat.regmatch.rm_ic = true; // try another time while ignoring case orgpat.regmatch.rm_ic = true; // try another time while ignoring case
} }
@ -2559,7 +2504,7 @@ static char_u *tag_full_fname(tagptrs_T *tagp)
/// ///
/// @param lbuf_arg line from the tags file for this tag /// @param lbuf_arg line from the tags file for this tag
/// @param forceit :ta with ! /// @param forceit :ta with !
/// @param keep_help keep help flag (false for cscope) /// @param keep_help keep help flag
/// ///
/// @return OK for success, NOTAGFILE when file not found, FAIL otherwise. /// @return OK for success, NOTAGFILE when file not found, FAIL otherwise.
static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help) static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)

View File

@ -14,7 +14,6 @@
#define DT_SELECT 7 // jump to selection from list #define DT_SELECT 7 // jump to selection from list
#define DT_HELP 8 // like DT_TAG, but no wildcards #define DT_HELP 8 // like DT_TAG, but no wildcards
#define DT_JUMP 9 // jump to new tag or selection from list #define DT_JUMP 9 // jump to new tag or selection from list
#define DT_CSCOPE 10 // cscope find command (like tjump)
#define DT_LTAG 11 // tag using location list #define DT_LTAG 11 // tag using location list
#define DT_FREE 99 // free cached matches #define DT_FREE 99 // free cached matches
@ -23,7 +22,6 @@
#define TAG_NAMES 2 // only return name of tag #define TAG_NAMES 2 // only return name of tag
#define TAG_REGEXP 4 // use tag pattern as regexp #define TAG_REGEXP 4 // use tag pattern as regexp
#define TAG_NOIC 8 // don't always ignore case #define TAG_NOIC 8 // don't always ignore case
#define TAG_CSCOPE 16 // cscope tag
#define TAG_VERBOSE 32 // message verbosity #define TAG_VERBOSE 32 // message verbosity
#define TAG_INS_COMP 64 // Currently doing insert completion #define TAG_INS_COMP 64 // Currently doing insert completion
#define TAG_KEEP_LANG 128 // keep current language #define TAG_KEEP_LANG 128 // keep current language

View File

@ -1,344 +0,0 @@
" Test for cscope commands.
source check.vim
CheckFeature cscope
CheckFeature quickfix
if !executable('cscope')
throw 'Skipped: cscope program missing'
endif
func CscopeSetupOrClean(setup)
if a:setup
noa sp samples/memfile_test.c
saveas! Xmemfile_test.c
call system('cscope -bk -fXcscope.out Xmemfile_test.c')
call system('cscope -bk -fXcscope2.out Xmemfile_test.c')
cscope add Xcscope.out
set cscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-,a-
else
cscope kill -1
for file in ['Xcscope.out', 'Xcscope2.out', 'Xmemfile_test.c']
call delete(file)
endfo
endif
endfunc
func Test_cscopeWithCscopeConnections()
call CscopeSetupOrClean(1)
" Test: E568: duplicate cscope database not added
try
set nocscopeverbose
cscope add Xcscope.out
set cscopeverbose
catch
call assert_report('exception thrown')
endtry
call assert_fails('cscope add', 'E560')
call assert_fails('cscope add Xcscope.out', 'E568')
call assert_fails('cscope add doesnotexist.out', 'E563')
if has('unix')
call assert_fails('cscope add /dev/null', 'E564:')
endif
" Test: Find this C-Symbol
for cmd in ['cs find s main', 'cs find 0 main']
let a = execute(cmd)
" Test where it moves the cursor
call assert_equal('main(void)', getline('.'))
" Test the output of the :cs command
call assert_match('\n(1 of 1): <<main>> main(void )', a)
endfor
" Test: Find this definition
for cmd in ['cs find g test_mf_hash',
\ 'cs find 1 test_mf_hash',
\ 'cs find 1 test_mf_hash'] " leading space ignored.
exe cmd
call assert_equal(['', '/*', ' * Test mf_hash_*() functions.', ' */', ' static void', 'test_mf_hash(void)', '{'], getline(line('.')-5, line('.')+1))
endfor
" Test: Find functions called by this function
for cmd in ['cs find d test_mf_hash', 'cs find 2 test_mf_hash']
let a = execute(cmd)
call assert_match('\n(1 of 42): <<mf_hash_init>> mf_hash_init(&ht);', a)
call assert_equal(' mf_hash_init(&ht);', getline('.'))
endfor
" Test: Find functions calling this function
for cmd in ['cs find c test_mf_hash', 'cs find 3 test_mf_hash']
let a = execute(cmd)
call assert_match('\n(1 of 1): <<main>> test_mf_hash();', a)
call assert_equal(' test_mf_hash();', getline('.'))
endfor
" Test: Find this text string
for cmd in ['cs find t Bram', 'cs find 4 Bram']
let a = execute(cmd)
call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
endfor
" Test: Find this egrep pattern
" test all matches returned by cscope
for cmd in ['cs find e ^\#includ.', 'cs find 6 ^\#includ.']
let a = execute(cmd)
call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
call assert_equal('#include <assert.h>', getline('.'))
cnext
call assert_equal('#include "main.c"', getline('.'))
cnext
call assert_equal('#include "memfile.c"', getline('.'))
call assert_fails('cnext', 'E553:')
endfor
" Test: Find the same egrep pattern using lcscope this time.
let a = execute('lcs find e ^\#includ.')
call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
call assert_equal('#include <assert.h>', getline('.'))
lnext
call assert_equal('#include "main.c"', getline('.'))
lnext
call assert_equal('#include "memfile.c"', getline('.'))
call assert_fails('lnext', 'E553:')
" Test: Find this file
for cmd in ['cs find f Xmemfile_test.c', 'cs find 7 Xmemfile_test.c']
enew
let a = execute(cmd)
call assert_true(a =~ '"Xmemfile_test.c" \d\+L, \d\+B')
call assert_equal('Xmemfile_test.c', @%)
endfor
" Test: Find files #including this file
for cmd in ['cs find i assert.h', 'cs find 8 assert.h']
enew
let a = execute(cmd)
let alines = split(a, '\n', 1)
call assert_equal('', alines[0])
call assert_true(alines[1] =~ '"Xmemfile_test.c" \d\+L, \d\+B')
call assert_equal('(1 of 1): <<global>> #include <assert.h>', alines[2])
call assert_equal('#include <assert.h>', getline('.'))
endfor
" Test: Invalid find command
call assert_fails('cs find', 'E560:')
call assert_fails('cs find x', 'E560:')
if has('float')
" Test: Find places where this symbol is assigned a value
" this needs a cscope >= 15.8
" unfortunately, Travis has cscope version 15.7
let cscope_version = systemlist('cscope --version')[0]
let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?'))
if cs_version >= 15.8
for cmd in ['cs find a item', 'cs find 9 item']
let a = execute(cmd)
call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = (mf_hashitem_T *)lalloc_clear(sizeof(*item), FALSE);'], split(a, '\n', 1))
call assert_equal(' item = (mf_hashitem_T *)lalloc_clear(sizeof(*item), FALSE);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
endfor
endif
endif
" Test: leading whitespace is not removed for cscope find text
let a = execute('cscope find t test_mf_hash')
call assert_equal(['', '(1 of 1): <<<unknown>>> test_mf_hash();'], split(a, '\n', 1))
call assert_equal(' test_mf_hash();', getline('.'))
" Test: test with scscope
let a = execute('scs find t Bram')
call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
" Test: cscope help
for cmd in ['cs', 'cs help', 'cs xxx']
let a = execute(cmd)
call assert_match('^cscope commands:\n', a)
call assert_match('\nadd :', a)
call assert_match('\nfind :', a)
call assert_match('\nhelp : Show this message', a)
call assert_match('\nkill : Kill a connection', a)
call assert_match('\nreset: Reinit all connections', a)
call assert_match('\nshow : Show connections', a)
endfor
let a = execute('scscope help')
call assert_match('This cscope command does not support splitting the window\.', a)
" Test: reset connections
let a = execute('cscope reset')
call assert_match('\nAdded cscope database.*Xcscope.out (#0)', a)
call assert_match('\nAll cscope databases reset', a)
" Test: cscope show
let a = execute('cscope show')
call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
" Test: cstag and 'csto' option
set csto=0
let a = execute('cstag TEST_COUNT')
call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
call assert_equal('#define TEST_COUNT 50000', getline('.'))
call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
set csto=1
let a = execute('cstag index_to_key')
call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
call assert_equal('#define index_to_key(i) ((i) ^ 15167)', getline('.'))
call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
call assert_fails('cstag', 'E562:')
let save_tags = &tags
set tags=
call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
let a = execute('cstag index_to_key')
call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
let &tags = save_tags
" Test: 'cst' option
set nocst
call assert_fails('tag TEST_COUNT', 'E426:')
set cst
let a = execute('tag TEST_COUNT')
call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
call assert_equal('#define TEST_COUNT 50000', getline('.'))
let a = execute('tags')
call assert_match('1 1 TEST_COUNT\s\+\d\+\s\+#define index_to_key', a)
" Test: 'cscoperelative'
call mkdir('Xcscoperelative')
cd Xcscoperelative
let a = execute('cs find g test_mf_hash')
call assert_notequal('test_mf_hash(void)', getline('.'))
set cscoperelative
let a = execute('cs find g test_mf_hash')
call assert_equal('test_mf_hash(void)', getline('.'))
set nocscoperelative
cd ..
call delete('Xcscoperelative', 'd')
" Test: E259: no match found
call assert_fails('cscope find g DOES_NOT_EXIST', 'E259:')
" Test: this should trigger call to cs_print_tags()
" Unclear how to check result though, we just exercise the code.
set cst cscopequickfix=s0
call feedkeys(":cs find s main\<CR>", 't')
" Test: cscope kill
call assert_fails('cscope kill', 'E560:')
call assert_fails('cscope kill 2', 'E261:')
call assert_fails('cscope kill xxx', 'E261:')
let a = execute('cscope kill 0')
call assert_match('cscope connection 0 closed', a)
cscope add Xcscope.out
let a = execute('cscope kill Xcscope.out')
call assert_match('cscope connection Xcscope.out closed', a)
cscope add Xcscope.out .
let a = execute('cscope kill -1')
call assert_match('cscope connection .*Xcscope.out closed', a)
let a = execute('cscope kill -1')
call assert_equal('', a)
" Test: 'csprg' option
call assert_equal('cscope', &csprg)
set csprg=doesnotexist
call assert_fails('cscope add Xcscope2.out', 'E609:')
set csprg=cscope
" Test: multiple cscope connections
cscope add Xcscope.out
cscope add Xcscope2.out . -C
let a = execute('cscope show')
call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
call assert_match('\n 1 \d\+.*Xcscope2.out\s*\.', a)
" Test: test Ex command line completion
call feedkeys(":cs \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"cs add find help kill reset show', @:)
call feedkeys(":scs \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"scs find', @:)
call feedkeys(":cs find \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"cs find a c d e f g i s t', @:)
call feedkeys(":cs kill \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"cs kill -1 0 1', @:)
call feedkeys(":cs add Xcscope\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"cs add Xcscope.out Xcscope2.out', @:)
" Test: cscope_connection()
call assert_equal(cscope_connection(), 1)
call assert_equal(cscope_connection(0, 'out'), 1)
call assert_equal(cscope_connection(0, 'xxx'), 1)
call assert_equal(cscope_connection(1, 'out'), 1)
call assert_equal(cscope_connection(1, 'xxx'), 0)
call assert_equal(cscope_connection(2, 'out'), 0)
call assert_equal(cscope_connection(2, getcwd() .. '/Xcscope.out', 1), 1)
call assert_equal(cscope_connection(3, 'xxx', '..'), 0)
call assert_equal(cscope_connection(3, 'out', 'xxx'), 0)
call assert_equal(cscope_connection(3, 'out', '.'), 1)
call assert_equal(cscope_connection(4, 'out', '.'), 0)
call assert_equal(cscope_connection(5, 'out'), 0)
call assert_equal(cscope_connection(-1, 'out'), 0)
call CscopeSetupOrClean(0)
endfunc
" Test ":cs add {dir}" (add the {dir}/cscope.out database)
func Test_cscope_add_dir()
call mkdir('Xcscopedir', 'p')
" Cscope doesn't handle symlinks, so this needs to be resolved in case a
" shadow directory is being used.
let memfile = resolve('./samples/memfile_test.c')
call system('cscope -bk -fXcscopedir/cscope.out ' . memfile)
cs add Xcscopedir
let a = execute('cscope show')
let lines = split(a, "\n", 1)
call assert_equal(3, len(lines))
call assert_equal(' # pid database name prepend path', lines[0])
call assert_equal('', lines[1])
call assert_match('^ 0 \d\+.*Xcscopedir/cscope.out\s\+<none>$', lines[2])
cs kill -1
call delete('Xcscopedir/cscope.out')
call assert_fails('cs add Xcscopedir', 'E563:')
call delete('Xcscopedir', 'd')
endfunc
func Test_cscopequickfix()
set cscopequickfix=s-,g-,d+,c-,t+,e-,f0,i-,a-
call assert_equal('s-,g-,d+,c-,t+,e-,f0,i-,a-', &cscopequickfix)
call assert_fails('set cscopequickfix=x-', 'E474:')
call assert_fails('set cscopequickfix=s', 'E474:')
call assert_fails('set cscopequickfix=s7', 'E474:')
call assert_fails('set cscopequickfix=s-a', 'E474:')
endfunc
func Test_withoutCscopeConnection()
call assert_equal(cscope_connection(), 0)
call assert_fails('cscope find s main', 'E567:')
let a = execute('cscope show')
call assert_match('no cscope connections', a)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@ -46,7 +46,6 @@ static const char *command_complete[] =
[EXPAND_COLORS] = "color", [EXPAND_COLORS] = "color",
[EXPAND_COMMANDS] = "command", [EXPAND_COMMANDS] = "command",
[EXPAND_COMPILER] = "compiler", [EXPAND_COMPILER] = "compiler",
[EXPAND_CSCOPE] = "cscope",
[EXPAND_USER_DEFINED] = "custom", [EXPAND_USER_DEFINED] = "custom",
[EXPAND_USER_LIST] = "customlist", [EXPAND_USER_LIST] = "customlist",
[EXPAND_USER_LUA] = "<Lua function>", [EXPAND_USER_LUA] = "<Lua function>",

View File

@ -138,7 +138,6 @@ enum {
EXPAND_USER_LIST, EXPAND_USER_LIST,
EXPAND_USER_LUA, EXPAND_USER_LUA,
EXPAND_SHELLCMD, EXPAND_SHELLCMD,
EXPAND_CSCOPE,
EXPAND_SIGN, EXPAND_SIGN,
EXPAND_PROFILE, EXPAND_PROFILE,
EXPAND_BEHAVE, EXPAND_BEHAVE,