File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 43
43
"patternProperties" : {
44
44
"repoMatch" : {
45
45
"type" : " string" ,
46
- "description" : " Regex to match repos associated to this Sentre project, e.g. github\\ .com/sourcegraph/sourcegraph"
46
+ "description" : " Regex to match repos associated to this Sentry project, e.g. github\\ .com/sourcegraph/sourcegraph"
47
47
},
48
48
"fileMatch" : {
49
49
"type" : " string" ,
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ function decorateEditor(editor: sourcegraph.CodeEditor): void {
39
39
}
40
40
41
41
export function activate ( context : sourcegraph . ExtensionContext ) : void {
42
+ sourcegraph . workspace . onDidOpenTextDocument . subscribe ( textDocument => {
43
+ const params = getParamsFromUriPath ( textDocument . uri )
44
+ } )
45
+
42
46
if ( sourcegraph . app . activeWindowChanges ) {
43
47
const activeEditor = from ( sourcegraph . app . activeWindowChanges ) . pipe (
44
48
filter ( ( window ) : window is sourcegraph . Window => window !== undefined ) ,
@@ -50,6 +54,25 @@ export function activate(context: sourcegraph.ExtensionContext): void {
50
54
}
51
55
}
52
56
57
+ /**
58
+ * Extract Sentry params from Document URI necessary to
59
+ * build URL to the Sentry issues stream page, if the current
60
+ * Document sends log events to Sentry.
61
+ *
62
+ * TODO: Implement regex match of params with Sentry extension config settings.
63
+ */
64
+ function getParamsFromUriPath ( textDocument : string ) : object {
65
+ const repoPattern = / g i t h u b \. c o m \/ ( [ ^ \? \# ] + ) / gi
66
+ const filePattern = / # ( [ ^ \? \# \/ ] + ) \/ .* \. t s x ? $ / gi
67
+ const repoM = repoPattern . exec ( textDocument )
68
+ const fileM = filePattern . exec ( textDocument )
69
+ const params = {
70
+ repo : repoM && repoM [ 1 ] ,
71
+ fileValidation : fileM ,
72
+ }
73
+ return params
74
+ }
75
+
53
76
function buildUrl ( errorQuery : string ) : URL {
54
77
const url = new URL (
55
78
'https://sentry.io/organizations/' +
You can’t perform that action at this time.
0 commit comments