Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getUserConfigFolderPath = (): string => {
const configFileFromEnv = process.env["ONI_CONFIG_FILE"] as string // tslint:disable-line
Log.info("$env:ONI_CONFIG_FILE: " + configFileFromEnv)
if (configFileFromEnv) {
const configDir = path.dirname(configFileFromEnv)
Log.info("getUserConfigFolderPath - path overridden by environment variable: " + configDir)
return configDir
}
return Platform.isWindows()
? path.join(Platform.getUserHome(), "oni")
: path.join(Platform.getUserHome(), ".config/oni") // XDG-compliant
}
public async init(filesToOpen: string[]): Promise {
Log.info("[OniEditor::init] Called with filesToOpen: " + filesToOpen)
return this._neovimEditor.init(filesToOpen)
}
public async init(
filesToOpen: string[],
startOptions?: Partial,
): Promise {
Log.info("[NeovimEditor::init] Called with filesToOpen: " + filesToOpen)
const defaultOptions: INeovimStartOptions = {
runtimePaths: this._pluginManager.getAllRuntimePaths(),
transport: this._configuration.getValue("experimental.neovim.transport"),
neovimPath: this._configuration.getValue("debug.neovimPath"),
loadInitVim: this._configuration.getValue("oni.loadInitVim"),
useDefaultConfig: this._configuration.getValue("oni.useDefaultConfig"),
}
const combinedOptions = {
...defaultOptions,
...startOptions,
}
await this._neovimInstance.start(combinedOptions)
if (this._errorInitializing) {
public leave(): void {
Log.info("[OniEditor::leave]")
this._neovimEditor.leave()
}
public leave(): void {
Log.info("[NeovimEditor::leave]")
this._actions.setHasFocus(false)
this._commands.deactivate()
this._neovimInstance.autoCommands.executeAutoCommand("FocusLost")
}
private _cleanupAfterSession(): void {
Log.info("[SnippetManager::cancel]")
this._disposables.forEach(d => d.dispose())
this._disposables = []
this._activeSession = null
}
}
public enter(): void {
Log.info("[NeovimEditor::enter]")
this._onEnterEvent.dispatch()
this._actions.setHasFocus(true)
this._commands.activate()
this._neovimInstance.autoCommands.executeAutoCommand("FocusGained")
this.checkAutoRead()
if (this.activeBuffer) {
this.notifyBufferEnter(this.activeBuffer)
}
}
private _end(): void {
Log.info("[LanguageClientProcess] Ending language server session")
if (this._connection) {
this._connection.dispose()
this._connection = null
}
if (this._process) {
this._process.kill()
this._process = null
}
}
}
const updateFromConfiguration = () => {
const areNotificationsEnabled = configuration.getValue("notifications.enabled")
Log.info("[Notifications] Setting enabled: " + areNotificationsEnabled)
areNotificationsEnabled ? _notifications.enable() : _notifications.disable()
}
public addConfigurationFile(filePath: string): void {
Log.info("[Configuration] Adding file: " + filePath)
const fp = new FileConfigurationProvider(filePath)
this.addConfigurationProvider(fp)
this._fileToProvider[filePath] = fp
}