* Updates the userSnippetsDir field if it has change, returning a boolean * indicating whether there was an update. If there was an update, resets the * maxSnippetMtime to -1 to ensure snippet update. * @returns Boolean indicating whether path has changed
()
| 81 | * @returns Boolean indicating whether path has changed |
| 82 | */ |
| 83 | private updateUserSnippetsPath(): boolean { |
| 84 | const newUserSnippetsDir = workspace |
| 85 | .getConfiguration("cursorless.experimental") |
| 86 | .get<string>("snippetsDir"); |
| 87 | |
| 88 | if (newUserSnippetsDir === this.userSnippetsDir) { |
| 89 | return false; |
| 90 | } |
| 91 | |
| 92 | // Reset mtime to -1 so that next time we'll update the snippets |
| 93 | this.maxSnippetMtimeMs = -1; |
| 94 | |
| 95 | this.userSnippetsDir = newUserSnippetsDir; |
| 96 | |
| 97 | return true; |
| 98 | } |
| 99 | |
| 100 | async updateUserSnippets() { |
| 101 | const snippetFiles = this.userSnippetsDir |