File tree Expand file tree Collapse file tree 1 file changed +31
-30
lines changed
src/vs/workbench/contrib/terminal/browser Expand file tree Collapse file tree 1 file changed +31
-30
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,35 @@ import { IXtermMarker } from 'vs/platform/terminal/common/capabilities/capabilit
17
17
import { ThemeIcon } from 'vs/base/common/themables' ;
18
18
import { Codicon } from 'vs/base/common/codicons' ;
19
19
20
+ const symbolMap : { [ key : string ] : string } = {
21
+ 'Ampersand' : '&' ,
22
+ 'ampersand' : '&' ,
23
+ 'Dollar' : '$' ,
24
+ 'dollar' : '$' ,
25
+ 'Percent' : '%' ,
26
+ 'percent' : '%' ,
27
+ 'Asterisk' : '*' ,
28
+ 'asterisk' : '*' ,
29
+ 'Plus' : '+' ,
30
+ 'plus' : '+' ,
31
+ 'Equals' : '=' ,
32
+ 'equals' : '=' ,
33
+ 'Exclamation' : '!' ,
34
+ 'exclamation' : '!' ,
35
+ 'Slash' : '/' ,
36
+ 'slash' : '/' ,
37
+ 'Backslash' : '\\' ,
38
+ 'backslash' : '\\' ,
39
+ 'Dot' : '.' ,
40
+ 'dot' : '.' ,
41
+ 'Period' : '.' ,
42
+ 'period' : '.' ,
43
+ 'Quote' : '\'' ,
44
+ 'quote' : '\'' ,
45
+ 'double quote' : '"' ,
46
+ 'Double quote' : '"' ,
47
+ } ;
48
+
20
49
export class TerminalSpeechToTextSession extends Disposable {
21
50
private _input : string = '' ;
22
51
private _ghostText : IDecoration | undefined ;
@@ -111,37 +140,9 @@ export class TerminalSpeechToTextSession extends Disposable {
111
140
private _updateInput ( e : ISpeechToTextEvent ) : void {
112
141
if ( e . text ) {
113
142
let input = e . text . replaceAll ( / [ . , ? ; ! ] / g, '' ) ;
114
- const symbolMap : { [ key : string ] : string } = {
115
- 'Ampersand' : '&' ,
116
- 'ampersand' : '&' ,
117
- 'Dollar' : '$' ,
118
- 'dollar' : '$' ,
119
- 'Percent' : '%' ,
120
- 'percent' : '%' ,
121
- 'Asterisk' : '*' ,
122
- 'asterisk' : '*' ,
123
- 'Plus' : '+' ,
124
- 'plus' : '+' ,
125
- 'Equals' : '=' ,
126
- 'equals' : '=' ,
127
- 'Exclamation' : '!' ,
128
- 'exclamation' : '!' ,
129
- 'Slash' : '/' ,
130
- 'slash' : '/' ,
131
- 'Backslash' : '\\' ,
132
- 'backslash' : '\\' ,
133
- 'Dot' : '.' ,
134
- 'dot' : '.' ,
135
- 'Period' : '.' ,
136
- 'period' : '.' ,
137
- 'Quote' : '\'' ,
138
- 'quote' : '\'' ,
139
- 'double quote' : '"' ,
140
- 'Double quote' : '"' ,
141
- } ;
142
143
143
- for ( const symbol in symbolMap ) {
144
- const regex : RegExp = new RegExp ( symbol ) ;
144
+ for ( const symbol of Object . values ( symbolMap ) ) {
145
+ const regex : RegExp = new RegExp ( symbol + '\b' ) ;
145
146
input = input . replace ( regex , symbolMap [ symbol ] ) ;
146
147
}
147
148
this . _input = ' ' + input ;
You can’t perform that action at this time.
0 commit comments