New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 747888 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

DevTools: Get cursor position in a Sources Panel from extension

Reported by e.genera...@gmail.com, Jul 24 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

Steps to reproduce the problem:
1. Extension sets callback function with chrome.devtools.panels.setOpenResourceHandler()
2. User opens a resource in Sources Panel and puts cursor in source editor somewhere.
2. User selects "Open using ..." from Context menu in the Source Panel.

What is the expected behavior?
Callback function registered with chrome.devtools.panels.setOpenResourceHandler() receives resource URL and a line number where cursor is located

What went wrong?
Callback doesn't receive a line number where cursor is located.

Did this work before? N/A 

Chrome version: 59.0.3071.115  Channel: stable
OS Version: 10.0
Flash Version: 

Receiving a cursor position with line number and column number will be perfect.

Already asked a question at https://stackoverflow.com/questions/45142863/how-to-get-cursor-position-in-a-chrome-devtools-source-editor-from-extension
 
Labels: Needs-Milestone
Cc: kkaluri@chromium.org
Labels: Needs-Feedback
e.generalov@ Could you please help us with the sample extension to triage this issue from TE-End.

Thank You...
Hi All,

Extension:
https://chrome.google.com/webstore/detail/open-in-editor/fmgbklepjbpnmgplnabblaehammnbmgg

Source code:
https://github.com/generalov/open-in-editor-extension/tree/master/src

The main idea is to take URL and line number (or probably line number with column if it possible) and send them to a backend using POST request to the URL:line:column resource. Server resolves location of file on file system, launches an external editor which puts a cursor to the same position.
Project Member

Comment 4 by sheriffbot@chromium.org, Jul 26 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "kkaluri@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Owner: caseq@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 6 by caseq@chromium.org, Sep 22 2017

Cc: jacobr@google.com
Status: Fixed (was: Assigned)
So first of all, setOpenResourceHandle() is for the cases when users click a link (e.g. a linkified location in console) that normally results in opening a source tab in DevTools, it's not meant to be fired when a file is explicitly opened in the source panel. For changes of the file/position within the sources tab, we've got chrome.devtools.panels.sources.onSelectionChanged (see a layout test for example usage: https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/http/tests/devtools/extensions/extensions-events.htmll=47) that  was recently brought back by jacobr@). I'm closing this as fixed, please feel free to reopen if this is not what you want.

Sign in to add a comment