Home Download Buy Blog Forum Support

get xpath at cursor

get xpath at cursor

Postby shaneknysh on Wed Nov 28, 2012 5:00 am

I am certain to get many snarky "Didn't you Google that!" responses but I just can not find a tool, plugin, or command to get the xpath at for the current cursor position. I have found at least two that will allow me to move the cursor to a new location in file based on a given xpath which is the exact opposite of what I want to do.

Any advice or assistance will be greatly appreciated!

Shane
shaneknysh
 
Posts: 3
Joined: Wed Nov 28, 2012 4:57 am

Re: get xpath at cursor

Postby sublimator on Wed Nov 28, 2012 6:55 am

Image

It's doable. Had a plugin for it on ST1, but to be honest, it wasn't really much use.

It was cool using xpath/css to create multiple selections though.

The sublime api isn't really thread safe bar set_timeout to queue callbacks in the main thread.

The way I wrote it was a bit crap so it was a bit bumpy.

I'd planned to rewrite it using generators and set_timeout for ui thread yield points, with cancellation on buffer modifications.

But you know, something shiny or something ...

Haven't ported it to ST2 yet.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 648
Joined: Thu Mar 20, 2008 5:41 am

Re: get xpath at cursor

Postby sublimator on Wed Nov 28, 2012 6:57 am

shaneknysh wrote:I have found at least two that will allow me to move the cursor to a new location in file based on a given xpath


Cool, would love to see the implementations of those to compare notes. Do you have links?
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 648
Joined: Thu Mar 20, 2008 5:41 am

Re: get xpath at cursor

Postby shaneknysh on Wed Nov 28, 2012 8:52 pm

this is the github for the search for xpath

https://github.com/madeingnecca/sublime-xpath-find
shaneknysh
 
Posts: 3
Joined: Wed Nov 28, 2012 4:57 am

Re: get xpath at cursor

Postby shaneknysh on Wed Nov 28, 2012 8:53 pm

This is the last piece of functionality I still have to open notepad++ for.
shaneknysh
 
Posts: 3
Joined: Wed Nov 28, 2012 4:57 am

Re: get xpath at cursor

Postby TheSaw on Thu Feb 21, 2013 9:34 am

I'm also looking for this. Any solutions?
TheSaw
 
Posts: 1
Joined: Thu Feb 21, 2013 9:31 am

Re: get xpath at cursor

Postby rosshadden on Thu Jun 13, 2013 8:48 pm

I made a plugin that does this. It works in Sublime Text 3, though I have not tested it in ST2.

https://github.com/rosshadden/sublime-xpath

The one caveat is that it has to be formatted XML. IE each child node has to be indented more than its parents. I honestly don't work in XML much; I made this for a coworker. Therefore if you want to address this limitation either open an issue or make a pull request.

Also note that it doesn't have the [4] index at the end of each level because my coworkers said that would actually be counterproductive, and they would just have to strip it out every time they copy a path.

With that said, enjoy!
rosshadden
 
Posts: 2
Joined: Sat Mar 02, 2013 4:02 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], kagaku, Yahoo [Bot] and 224 guests