Giter Site home page Giter Site logo

Add tag stack about vim-racer HOT 16 CLOSED

racer-rust avatar racer-rust commented on August 25, 2024 2
Add tag stack

from vim-racer.

Comments (16)

Shougo avatar Shougo commented on August 25, 2024 2

settagstack()/gettagstack() are added in Vim 8.1.0519.
You can implement the feature.

I will check the PR.

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024 1

Could we add add-to-stack functionality to rust-def instead?

We cannot add/change the tag stack from Vim script.

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024 1

OK. I have reopened. I don't work for it though.

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024

I think you need to add the feature in the function.
And you must add the CTRL-T keymapping for it.

https://github.com/racer-rust/vim-racer/blob/master/autoload/racer.vim#L176

from vim-racer.

vext01 avatar vext01 commented on August 25, 2024

I was about to report this also, but I see someone beat me to it.

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024

tag stack is the builtin function.
So we cannot extend it.

from vim-racer.

asymmetric avatar asymmetric commented on August 25, 2024

Could we add add-to-stack functionality to rust-def instead?

Don't know much of vim/neovim internals though :)

from vim-racer.

asymmetric avatar asymmetric commented on August 25, 2024

I guess this can be closed then. Thanks!

from vim-racer.

twmb avatar twmb commented on August 25, 2024

How does cscope modify the tag stack, or vim-go? I'd be interested in pursuing whatever route they ended up taking.

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024

How does cscope modify the tag stack, or vim-go? I'd be interested in pursuing whatever route they ended up taking.

cscope is builtin function.

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024

vim-go modify the tag stack?
Really? I will check it.

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024

https://github.com/fatih/vim-go/blob/5db7dd6a618ffad89d270e97dbf47bf484747ad1/autoload/go/def.vim

vim-go does not change vim tag stack.
It just changes the jump list and the original stack.

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024

If you can, pull request is wellcome.

from vim-racer.

shabbyrobe avatar shabbyrobe commented on August 25, 2024

@Shougo, even if you don't necessarily want to work on this yourself, I don't think this issue should be closed until there's a proper resolution, whether that resolution happens here or in Vim itself (see issue vim/vim#3336). Tag stack keybindings usually work in vim language integration plugins. I use jedi-vim (python), vim-go and tsuquyomi (typescript) nearly every day and they all support this functionality; it's pretty much par for the course.

If it helps anyone, I found a plugin (vim-tagimposter) that lets you simulate the needed functionality with the following mapping:

au FileType rust nmap <C-]> :<C-u> TagImposterAnticipateJump <Bar> :call racer#GoToDefinition()<CR>

It seems you can't do <Plug>(rust-def) as it throws the dreaded "Trailing Characters" error.

CTRL-T works, as does CTRL-]. I ran into some trouble with functions that racer could not find - it puts it into the tag stack anyway. I will follow this up at the vim-tagimposter repo as well, maybe there's something silly I'm doing wrong. My vimscript knowledge is rudimentary at best. Here's a minimal reproducing example:

extern crate yep;

use std::io;
use std::io::prelude::*;
use std::fs::File;

fn main() -> io::Result<()> {
    let mut f = File::open("file_that_totally_exists.txt")?;
    let mut buffer = Vec::new();
    f.read_to_end(&mut buffer)?;
    Ok(())
}

If I try to jump to read_to_end, racer does not find the definition but the tag still appears in :tags and I have to pop it off myself with CTRL-T.

Still, progress is progress; I hope this helps somebody.

from vim-racer.

shabbyrobe avatar shabbyrobe commented on August 25, 2024

No problem, that's totally reasonable, you've already done plenty for us by providing this plugin in the first place. Thank you for re-opening the issue.

I would hope that ultimately vim would be fixed to cater to this extremely common use case. If and when they fix vim, would you accept a PR to integrate with it?

from vim-racer.

Shougo avatar Shougo commented on August 25, 2024

If and when they fix vim, would you accept a PR to integrate with it?

Of course, yes. I will check the PR.

from vim-racer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.