File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 22
22
"editor/title" : [],
23
23
"commandPalette" : []
24
24
},
25
- "configuration" : {}
25
+ "configuration" : {
26
+ "title" : " Sentry extension settings" ,
27
+ "properties" : {
28
+ "sentry.organization" : {
29
+ "description" : " Name of the Sentry organization" ,
30
+ "type" : " string" ,
31
+ "default" : " "
32
+ },
33
+ "sentry.projects" : {
34
+ "description" : " List of projects collecting logs" ,
35
+ "type" : " array" ,
36
+ "default" : []
37
+ }
38
+ }
39
+ }
26
40
},
27
41
"version" : " 0.0.0-DEVELOPMENT" ,
28
42
"repository" : {
Original file line number Diff line number Diff line change
1
+ /**
2
+ * The resolved and normalized settings for this extension, the result of calling resolveSettings on a raw settings
3
+ * value.
4
+ *
5
+ * See the "contributes.configuration" field in package.json for the canonical documentation on these properties.
6
+ */
7
+ export interface Settings {
8
+ [ 'sentry.organization' ] ?: string
9
+ [ 'sentry.projects' ] ?: [ ]
10
+ }
11
+
12
+ /** Returns a copy of the extension settings with values normalized and defaults applied. */
13
+ export function resolveSettings ( raw : Partial < Settings > ) : Settings {
14
+ return {
15
+ [ 'sentry.organization' ] : raw [ 'sentry.organization' ] ,
16
+ [ 'sentry.projects' ] : raw [ 'sentry.projects' ] ,
17
+ }
18
+ }
Original file line number Diff line number Diff line change 1
1
import { from } from 'rxjs'
2
2
import { filter , switchMap } from 'rxjs/operators'
3
3
import * as sourcegraph from 'sourcegraph'
4
+ import { resolveSettings , Settings } from './settings'
4
5
5
6
const CODE_PATTERNS = [
6
7
/ t h r o w n e w E r r o r + \( [ \' \" ] ( [ ^ \' \" ] + ) [ \' \" ] \) / gi,
@@ -9,6 +10,7 @@ const CODE_PATTERNS = [
9
10
]
10
11
11
12
const DECORATION_TYPE = sourcegraph . app . createDecorationType ( )
13
+ const SETTINGS = resolveSettings ( sourcegraph . configuration . get < Settings > ( ) . value )
12
14
13
15
function decorateEditor ( editor : sourcegraph . CodeEditor ) : void {
14
16
const decorations : sourcegraph . TextDocumentDecoration [ ] = [ ]
@@ -50,7 +52,9 @@ export function activate(context: sourcegraph.ExtensionContext): void {
50
52
51
53
function buildUrl ( errorQuery : string ) : URL {
52
54
const url = new URL (
53
- 'https://sentry.io/organizations/sourcegraph/issues/?project=1334031&query=is%3Aunresolved+' +
55
+ 'https://sentry.io/organizations/' +
56
+ SETTINGS [ 'sentry.organization' ] +
57
+ '/issues/?project=1334031&query=is%3Aunresolved+' +
54
58
errorQuery . split ( ' ' ) . join ( '+' ) +
55
59
'&statsPeriod=14d'
56
60
)
You can’t perform that action at this time.
0 commit comments