File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -288,6 +288,17 @@ describe('config-io', () => {
288288 expect ( saved . lsp ) . toBe ( false ) ;
289289 } ) ;
290290
291+ test ( 'enableLspByDefault does not write when lsp exists' , ( ) => {
292+ const configPath = join ( tmpDir , 'opencode' , 'opencode.json' ) ;
293+ paths . ensureConfigDir ( ) ;
294+ writeFileSync ( configPath , JSON . stringify ( { lsp : false } ) ) ;
295+
296+ const result = enableLspByDefault ( ) ;
297+ expect ( result . success ) . toBe ( true ) ;
298+
299+ expect ( existsSync ( `${ configPath } .bak` ) ) . toBe ( false ) ;
300+ } ) ;
301+
291302 test ( 'detectCurrentConfig detects installed status' , ( ) => {
292303 const configPath = join ( tmpDir , 'opencode' , 'opencode.json' ) ;
293304 const litePath = join ( tmpDir , 'opencode' , 'oh-my-opencode-slim.json' ) ;
Original file line number Diff line number Diff line change @@ -324,9 +324,9 @@ export function enableLspByDefault(): ConfigMergeResult {
324324
325325 if ( config . lsp === undefined ) {
326326 config . lsp = true ;
327+ writeConfig ( configPath , config ) ;
327328 }
328329
329- writeConfig ( configPath , config ) ;
330330 return { success : true , configPath } ;
331331 } catch ( err ) {
332332 return {
You can’t perform that action at this time.
0 commit comments