@@ -7,13 +7,16 @@ import { getCurrentUser } from './util'
77// TODO(sqs) SECURITY(sqs): sanitize for real
88const escapedMarkdownCode = ( text : string ) : string => '`' + text . replace ( / ` / g, '\\`' ) + '`'
99
10+ // TODO: make this file filter configurable.
11+ // The filter is applied on all files of each matching repo (confirm - is that correct?)
12+ const fileFilter = ( path : string ) : boolean => path . endsWith ( '.yaml' ) || path . endsWith ( '.yml' ) || path . endsWith ( '.md' )
13+
1014export const registerFindReplaceAction = ( ) : Subscription => {
1115 const subscription = new Subscription ( )
1216 subscription . add (
1317 sourcegraph . commands . registerCommand ( 'start-find-replace' , async ( ) => {
14-
1518 // To create campaigns, a namespace is used, which can be the current user's username.
16- const currentUser = await getCurrentUser ( ) ;
19+ const currentUser = await getCurrentUser ( )
1720 const namespaceName = currentUser ?. username
1821 console . log ( 'currentUser' , currentUser )
1922
@@ -47,8 +50,7 @@ export const registerFindReplaceAction = (): Subscription => {
4750 description,
4851 steps : [
4952 {
50- fileFilter : path =>
51- path . endsWith ( '.yaml' ) || path . endsWith ( '.yml' ) || path . endsWith ( '.md' ) , // TODO(sqs)
53+ fileFilter,
5254 editFile : ( path , text ) => {
5355 if ( ! text . includes ( match ) ) {
5456 return null
@@ -72,7 +74,7 @@ export const registerFindReplaceAction = (): Subscription => {
7274 message : description ,
7375 author : {
7476 name : currentUser . username ,
75- email : currentUser . email
77+ email : currentUser . email ,
7678 } ,
7779 } ,
7880 published : false ,
0 commit comments