Bug 189589 - Add Copy WebKit Permalink plugin for Sublime Text
Summary: Add Copy WebKit Permalink plugin for Sublime Text
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks: 215418
  Show dependency treegraph
 
Reported: 2018-09-13 10:08 PDT by Daniel Bates
Modified: 2020-08-12 11:34 PDT (History)
10 users (show)

See Also:


Attachments
Patch (42.81 KB, patch)
2018-09-13 10:39 PDT, Daniel Bates
joepeck: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2018-09-13 10:08:00 PDT
I frequently switch between Xcode and Sublime Text 3. We should port the Copy WebKit Permalink Automator service to a Sublime Text plugin so that the same functionality can be accessed in Sublime Text. Porting to a Sublime Text plugin would also make this convenience service available to a larger audience because Sublime Text is cross-platform (available on Mac, Linux, and Windows at the time of writing).
Comment 1 Daniel Bates 2018-09-13 10:39:14 PDT
Created attachment 349679 [details]
Patch

I tested this plugin in Sublime Text 3 on Mac version 3.1.1 (build 3176). If someone wants to test aon Window or Linxu that would be great. It should work in Sublime Text 2 given that I used <https://code.tutsplus.com/tutorials/how-to-create-a-sublime-text-2-plugin--net-22685> as a reference when writing the plugin. For now, there are only key bindings for Mac because that is the platform I use and is the platform I am most familiar with the keyboard shortcut conventions for. Do any Windows or Linux developers have suggestions for good (read: do not conflict with other apps) key bindings sequences? We need two sequences: one for generating a permalink without blame annotations and one for generating a permalink with blame annotations.
Comment 2 EWS Watchlist 2018-09-13 10:40:32 PDT
Attachment 349679 [details] did not pass style-queue:


ERROR: Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/CopyWebKitPermalink.py:35:  [CopyWebKitPermalinkCommand.run] Instance of 'CopyWebKitPermalinkCommand' has no 'view' member  [pylint/E1101] [5]
ERROR: Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/CopyWebKitPermalink.py:43:  [CopyWebKitPermalinkCommand.run] Instance of 'CopyWebKitPermalinkCommand' has no 'view' member  [pylint/E1101] [5]
ERROR: Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/CopyWebKitPermalink.py:43:  [CopyWebKitPermalinkCommand.run] Instance of 'CopyWebKitPermalinkCommand' has no 'view' member  [pylint/E1101] [5]
ERROR: Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/CopyWebKitPermalink.py:51:  [CopyWebKitPermalinkCommand.is_enabled] Instance of 'CopyWebKitPermalinkCommand' has no 'view' member  [pylint/E1101] [5]
ERROR: Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/CopyWebKitPermalink.py:51:  [CopyWebKitPermalinkCommand.is_enabled] Instance of 'CopyWebKitPermalinkCommand' has no 'view' member  [pylint/E1101] [5]
Total errors found: 5 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Daniel Bates 2018-09-13 10:44:02 PDT
(In reply to Build Bot from comment #2)
> Attachment 349679 [details] did not pass style-queue:
> 
> 
> ERROR: Tools/CopyPermalink/Sublime
> Text/CopyWebKitPermalink/CopyWebKitPermalink.py:35: 
> [CopyWebKitPermalinkCommand.run] Instance of 'CopyWebKitPermalinkCommand'
> has no 'view' member  [pylint/E1101] [5]
> ERROR: Tools/CopyPermalink/Sublime
> Text/CopyWebKitPermalink/CopyWebKitPermalink.py:43: 
> [CopyWebKitPermalinkCommand.run] Instance of 'CopyWebKitPermalinkCommand'
> has no 'view' member  [pylint/E1101] [5]
> ERROR: Tools/CopyPermalink/Sublime
> Text/CopyWebKitPermalink/CopyWebKitPermalink.py:43: 
> [CopyWebKitPermalinkCommand.run] Instance of 'CopyWebKitPermalinkCommand'
> has no 'view' member  [pylint/E1101] [5]
> ERROR: Tools/CopyPermalink/Sublime
> Text/CopyWebKitPermalink/CopyWebKitPermalink.py:51: 
> [CopyWebKitPermalinkCommand.is_enabled] Instance of
> 'CopyWebKitPermalinkCommand' has no 'view' member  [pylint/E1101] [5]
> ERROR: Tools/CopyPermalink/Sublime
> Text/CopyWebKitPermalink/CopyWebKitPermalink.py:51: 
> [CopyWebKitPermalinkCommand.is_enabled] Instance of
> 'CopyWebKitPermalinkCommand' has no 'view' member  [pylint/E1101] [5]
> Total errors found: 5 in 8 files
> 
> 
> If any of these errors are false positives, please file a bug against
> check-webkit-style.

These warnings can be ignored as Pylint does not have access to the Sublime modules to check dependencies related to inheritance from class sublime_plugin.TextCommand.
Comment 4 Joseph Pecoraro 2018-09-13 10:52:53 PDT
Comment on attachment 349679 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=349679&action=review

Neat! rs=me

> Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/Context.sublime-menu:2
> +    { "command": "copy_web_kit_permalink" },

Why "web_kit" and not "webkit"?

> Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/Default (OSX).sublime-keymap:2
> +	{ "keys": ["super+ctrl+shift+c"], "command": "copy_web_kit_permalink" },

Ditto.
Comment 5 Joseph Pecoraro 2018-09-13 10:54:09 PDT
Comment on attachment 349679 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=349679&action=review

>> Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/Context.sublime-menu:2
>> +    { "command": "copy_web_kit_permalink" },
> 
> Why "web_kit" and not "webkit"?

Maybe this was needed to convert to the python class name: CopyWebKitPermalinkCommand
Comment 6 Daniel Bates 2018-09-13 11:03:57 PDT
(In reply to Joseph Pecoraro from comment #5)
> Comment on attachment 349679 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=349679&action=review
> 
> >> Tools/CopyPermalink/Sublime Text/CopyWebKitPermalink/Context.sublime-menu:2
> >> +    { "command": "copy_web_kit_permalink" },
> > 
> > Why "web_kit" and not "webkit"?
> 
> Maybe this was needed to convert to the python class name:
> CopyWebKitPermalinkCommand

Correct.
Comment 7 Daniel Bates 2018-09-13 11:07:32 PDT
Committed r235981: <https://trac.webkit.org/changeset/235981>
Comment 8 Radar WebKit Bug Importer 2018-09-13 11:08:25 PDT
<rdar://problem/44424184>