1- import { CharacterPair , languages , ViewColumn , window , workspace } from 'vscode' ;
1+ import { CharacterPair , Event , EventEmitter , languages , ViewColumn , window , workspace } from 'vscode' ;
22import configuration from '../../language-configuration.json' ;
33import { getCurrentTextDocument } from '../utils/workspaceUtility' ;
44import { Headers } from './base' ;
@@ -35,6 +35,8 @@ export interface IRestClientSettings {
3535 addRequestBodyLineIndentationAroundBrackets : boolean ;
3636 decodeEscapedUnicodeCharacters : boolean ;
3737 logLevel : LogLevel ;
38+ enableSendRequestCodeLens : boolean ;
39+ enableCustomVariableReferencesCodeLens : boolean ;
3840}
3941
4042export class RestClientSettings implements IRestClientSettings {
@@ -66,6 +68,8 @@ export class RestClientSettings implements IRestClientSettings {
6668 public addRequestBodyLineIndentationAroundBrackets : boolean ;
6769 public decodeEscapedUnicodeCharacters : boolean ;
6870 public logLevel : LogLevel ;
71+ public enableSendRequestCodeLens : boolean ;
72+ public enableCustomVariableReferencesCodeLens : boolean ;
6973
7074 private readonly brackets : CharacterPair [ ] ;
7175
@@ -79,14 +83,22 @@ export class RestClientSettings implements IRestClientSettings {
7983 return RestClientSettings . _instance ;
8084 }
8185
86+ public readonly configurationUpdateEventEmitter = new EventEmitter < void > ( ) ;
87+
88+ public get onDidChangeConfiguration ( ) : Event < void > {
89+ return this . configurationUpdateEventEmitter . event ;
90+ }
91+
8292 private constructor ( ) {
8393 this . brackets = configuration . brackets as CharacterPair [ ] ;
8494 workspace . onDidChangeConfiguration ( ( ) => {
8595 this . initializeSettings ( ) ;
96+ this . configurationUpdateEventEmitter . fire ( ) ;
8697 } ) ;
87- window . onDidChangeActiveTextEditor ( ( e ) => {
98+ window . onDidChangeActiveTextEditor ( e => {
8899 if ( e ) {
89100 this . initializeSettings ( ) ;
101+ this . configurationUpdateEventEmitter . fire ( ) ;
90102 }
91103 } ) ;
92104
@@ -130,6 +142,8 @@ export class RestClientSettings implements IRestClientSettings {
130142 this . addRequestBodyLineIndentationAroundBrackets = restClientSettings . get < boolean > ( 'addRequestBodyLineIndentationAroundBrackets' , true ) ;
131143 this . decodeEscapedUnicodeCharacters = restClientSettings . get < boolean > ( 'decodeEscapedUnicodeCharacters' , false ) ;
132144 this . logLevel = ParseLogLevelStr ( restClientSettings . get < string > ( 'logLevel' , 'error' ) ) ;
145+ this . enableSendRequestCodeLens = restClientSettings . get < boolean > ( 'enableSendRequestCodeLens' , true ) ;
146+ this . enableCustomVariableReferencesCodeLens = restClientSettings . get < boolean > ( 'enableCustomVariableReferencesCodeLens' , true ) ;
133147 languages . setLanguageConfiguration ( 'http' , { brackets : this . addRequestBodyLineIndentationAroundBrackets ? this . brackets : [ ] } ) ;
134148
135149 const httpSettings = workspace . getConfiguration ( "http" ) ;
0 commit comments