File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[
22 {
3- "caption" : " C# WebForms: Open CodeBehind/ CodeFile" ,
3+ "caption" : " C# WebForms: Open CodeBehind / CodeFile" ,
44 "command" : " open_code_file_from_front_end" ,
55 },
6+ {
7+ "caption" : " C# WebForms: Open Front End" ,
8+ "command" : " open_front_end_from_code_file" ,
9+ },
610]
Original file line number Diff line number Diff line change 11import sublime
22import sublime_plugin
3+ from re import search
4+ from os .path import isfile
35
46
57class OpenCodeFileFromFrontEndCommand (sublime_plugin .TextCommand ):
@@ -15,3 +17,19 @@ def run(self, edit):
1517 region = self .view .find_by_selector ('meta.path.codefile' )[0 ]
1618 codefile = self .view .substr (region )
1719 self .view .window ().open_file (str (codefile ))
20+
21+
22+ class OpenFrontEndFromCodeFileCommand (sublime_plugin .TextCommand ):
23+ """Naively open foo.ascx from foo.ascx.cs"""
24+
25+ def is_enabled (self ):
26+ filename = self .view .file_name ()
27+ if ((filename
28+ and self .view .match_selector (0 , 'source.cs' )
29+ and search (r'\.(?:as[pc]x|master)\.cs$' , filename )
30+ and isfile (filename [:- 3 ]))):
31+ return True
32+ return False
33+
34+ def run (self , edit ):
35+ self .view .window ().open_file (self .view .file_name ()[:- 3 ])
You can’t perform that action at this time.
0 commit comments