-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup and address obsidian releases feedback #16
Conversation
@@ -1,4 +1,4 @@ | |||
import { App, PluginSettingTab, Setting, SliderComponent } from 'obsidian' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import
getByFilePath(filePath: string): Vector { | ||
return this.filePathToVector.get(filePath) as Vector | ||
getByFilePath(filePath: string): Vector | undefined { | ||
return this.filePathToVector.get(filePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to cast here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused code from initially incorporating react
@@ -143,8 +143,12 @@ export default class VaultChat extends Plugin { | |||
const searchResults = Array.from(nearestVectors.keys()) | |||
const hydratedResults = [] | |||
for (const searchResult of searchResults) { | |||
const abstractFile = app?.vault.getAbstractFileByPath(searchResult) as TFile | |||
const fileContentsOrEmpty = await app?.vault.read(abstractFile) | |||
const abstractFile = this.app.vault.getAbstractFileByPath(searchResult) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't access global app
, instead using this.app
const abstractFile = app?.vault.getAbstractFileByPath(searchResult) as TFile | ||
const fileContentsOrEmpty = await app?.vault.read(abstractFile) | ||
const abstractFile = this.app.vault.getAbstractFileByPath(searchResult) | ||
if (!(abstractFile instanceof TFile)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if result is actually a file and not a folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused code from initially incorporating react
obsidianmd/obsidian-releases#1752 (comment)