The text document in Xcode 9 beta doesn't have "selected paragraph range" and "selected character range" properties
| Originator: | KHaiFeng | ||
| Number: | rdar://32970899 | Date Originated: | June 25 2017 |
| Status: | open | Resolved: | |
| Product: | Xcode | Product Version: | 9 |
| Classification: | Bug | Reproducible: | Always |
Summary:
The absence of the properties make it impossible to get the current line number in Xcode 9. It makes some Xcode plugins unusable.
Steps to Reproduce:
1. open a workspace with Xcode 9 beta
2. open a document to edit
3. run the following applescript
set Xcode to "Xcode-beta"
set current_document_path to ""
tell application Xcode
set last_word_in_main_window to (word -1 of (get name of window 1))
if (last_word_in_main_window is "Edited") then
activate
tell application "System Events" to keystroke "s" using {command down} -- command-s to save the file
end if
#get the file name again
set last_word_in_main_window to (word -1 of (get name of window 1))
set current_document to document 1 whose name ends with last_word_in_main_window
set current_document_path to path of current_document
#get the current line number
using terms from application "Xcode-beta"
tell current_document
set {startLine, endLine} to selected paragraph range
end tell
end using terms from
end tell
return (startLine as string) & "&" & current_document_path
Expected Results:
should get the current line number and the document path
Observed Results:
the script fails because it cannot find selected paragraph range
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!