File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { getReactionGroup } from './reactions/resource';
55import { RemoteDb } from './persistence/remote-db' ;
66import { v4 as uuidv4 } from 'uuid' ;
77import { Deserializer } from './persistence/serialization/deserializer' ;
8+ import { saveNotesToFile } from './persistence/local-db' ;
89
910export const saveNoteComment = (
1011 thread : vscode . CommentThread ,
@@ -32,6 +33,7 @@ export const saveNoteComment = (
3233 thread . contextValue = uuidv4 ( ) ;
3334 noteMap . set ( thread . contextValue , thread ) ;
3435 }
36+ saveNotesToFile ( noteMap ) ;
3537 if ( remoteDb ) {
3638 remoteDb . pushNoteComment ( thread , firstComment ) ;
3739 }
@@ -148,6 +150,8 @@ export const syncNoteMapWithRemote = (
148150 remoteDb && remoteDb . pushNoteComment ( localThread , true ) ;
149151 }
150152 } ) ;
153+
154+ saveNotesToFile ( noteMap ) ;
151155} ;
152156
153157export const getSetting = ( settingName : string , defaultValue ?: any ) => {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as rethinkdb from 'rethinkdb';
33import { Serializer } from '../serialization/serializer' ;
44import { Deserializer } from '../serialization/deserializer' ;
55import { readFileSync } from 'fs' ;
6+ import { saveNotesToFile } from '../local-db' ;
67
78export class RemoteDb {
89 private host : string ;
@@ -134,6 +135,7 @@ export class RemoteDb {
134135 newThread . contextValue ? newThread . contextValue : '' ,
135136 newThread ,
136137 ) ;
138+ saveNotesToFile ( this . noteMap ) ;
137139 vscode . window . showInformationMessage ( 'Note received from remote DB.' ) ;
138140 } ) ;
139141 } ) ;
Original file line number Diff line number Diff line change 33import * as vscode from 'vscode' ;
44import * as path from 'path' ;
55import { platform } from 'os' ;
6- import { getSetting } from '../helpers' ;
76
87export const isWindows = ( ) => {
98 return platform ( ) === 'win32' ;
@@ -26,7 +25,9 @@ export const getWorkspacePath = () => {
2625} ;
2726
2827export const getLocalDbFilePath = ( ) => {
29- const localDbFilePath = getSetting ( 'localDatabase' ) ;
28+ const localDbFilePath = vscode . workspace
29+ . getConfiguration ( 'security-notes' )
30+ . get < string > ( 'localDatabase' , '.security-notes.json' ) ;
3031 if ( path . isAbsolute ( localDbFilePath ) ) {
3132 return localDbFilePath ;
3233 } else {
You can’t perform that action at this time.
0 commit comments