Skip to content
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

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

kristenbrann
Copy link
Member

@@ -1,4 +1,4 @@
import { App, PluginSettingTab, Setting, SliderComponent } from 'obsidian'
Copy link
Member Author

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)
Copy link
Member Author

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

Copy link
Member Author

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)
Copy link
Member Author

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)) {
Copy link
Member Author

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

Copy link
Member Author

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

@cpaika cpaika merged commit 24993f6 into exoascension:main Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants