Coder Social home page Coder Social logo

pierrad / obsidian-github-copilot Goto Github PK

View Code? Open in Web Editor NEW
83.0 2.0 6.0 13.79 MB

A bridge between Obsidian and Github Copilot

License: Apache License 2.0

JavaScript 96.79% TypeScript 3.12% CSS 0.09%
ai completion copilot github github-copilot obsidian obsidian-md plugin

obsidian-github-copilot's Introduction

Obsidian Github Copilot Plugin

Obsidian plugin GitHub release (latest by date including pre-releases)

Use Github Copilot in the Obsidian editor. This plugin is a bridge between the Obsidian editor and the Github Copilot service.

https://github.com/Pierrad/obsidian-github-copilot/tree/master/.github/assets/example.gif

Requirements

  • A Github Copilot subscription (https://copilot.github.com/)
  • Node.js 18 or later
  • Network connection to send and receive data from the Github Copilot service

Installation

  1. Install the plugin via the Obsidian community plugins browser.
  2. Go to the plugin settings and enter the path to the Node +18 binary. You can find it by running which node in your terminal.
  3. Either
    1. A modal will appear asking you to sign in to Copilot. Follow the instructions to sign in.
    2. Or, you will receive a notice saying that Copilot is ready to use. (This will happen if you have already signed in to Copilot in the past in IDEs)

Note

If you install the plugin by cloning it or downloading the release files from Github, you will need to name the plugin folder github-copilot for the plugin to work.

Usage

  1. Open a note in Obsidian.
  2. Write something in the editor.
  3. After a small pause, Copilot will suggest completions for your text.
  4. Press Tab to accept a suggestion or Esc to dismiss it.

Features

  • Use Github Copilot in the Obsidian editor
  • Configure the suggestion generation delay
  • Configure your bindings to accept, dismiss, trigger or partially accept suggestions
  • Configure if you want to see automatic suggestions or only trigger them manually
  • Configure if you want to see suggestion only in code blocks or in the whole note
  • Exclude folders and files from the suggestion generation

Known issues

  • If you installed Obsidian with Flatpak, you might need to use NVM to handle Node.js versions as the default binary path is not accessible in the Flatpak sandbox. See this issue for more information.

obsidian-github-copilot's People

Contributors

donovan-ye avatar ducan-ne avatar github-actions[bot] avatar pierrad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

obsidian-github-copilot's Issues

Partial suggestion Acceptance similar to VS-Code

Is your feature request related to a problem? Please describe.
Often, the beginning of a Copilot suggestion is exactly what I want, but it continues too long (writing a whole paragraph) or goes off into an unwanted direction later on. Currently, there is only an "All or Nothing" acceptance option.

Describe the solution you'd like
An option to accept suggestions word by word, similar to VS Code's Ctrl+RightArrow keybind, which allows you to accept parts of the suggestion without triggering a whole new generation. See the GIF below for an example:
Example single word acceptance

Describe alternatives you've considered
The current alternative is to accept everything and delete the unwanted parts afterward.

I also tried coding a hacky solution where I split the suggestion string by spaces and accept only the first element of the list using a shortcut. However, this caused a new suggestion generation each time, resulting in wait times and the possibility of changing the prediction.

Additional configuration: Delay before generating, Only inside codeblocks, Hotkey to trigger generation

Is your feature request related to a problem? Please describe.

Great plugin, I'd suggest a few additional configuration options:

  • Configurable delay before generating (e.g. only generate if paused for 1s)
  • Only run inside codeblocks (so your normal note content doesn't try to auto-complete, but code inside code blocks does)
  • Option to only complete on hotkey (e.g. cmd+shift+/ to trigger a generation)

A hotkey setting for enabling/disabling copilot.

When I'm using Obsidian there are distinct scenarios when I always want copilot suggestions and never want copilot suggestions. For example: I want copilot off when writing creatively and on when drafting email templates and doing other mundane tasks.

The current features for enabling and disabling with folders are very good but when switching between tasks very quickly it would be more convenient to just hit a hotkey to disable/enable copilot suggestions.

Edit: Forgot to add the context that I'm using Vim so the status bar isn't super convenient to use.

Plugin do nothing after install

Hi, first thank you for creating this awesome plugin
I've 2 questions

  • It couldn't be found in https://obsidian.md/plugins?search=copilot, I think it'd be better to publish to that instead of manual install by downloading in release in github

  • After manual install, it show setting and I did all the instructions, but nothing happens when I type anything, any hint for this? I've copilot subscription and node path work well. I've tried with node repl but it still works. I haven't seen anything like "A notice will appear in the editor telling you that Copilot is ready to use.", but copilot work in my IDE

My recording:

CleanShot.2024-05-06.at.19.44.35.mp4

Ps: tried restart, reinstall but couldn't help

[feature request] alternative or custom key for completion

Thank you so much for this plugin! Copilot is finally here for Obsidian!

Like Vim, Tab for completion here is tricky in Obsidian, as many plugins register this key. For example, when LaTeX Suite is enabled, the Tab key won't work for GitHub Copilot. Is it possible to use keys other than Tab? It would be great if the user can configure it.

Accept suggestion doesn't work

Describe the bug

No matter what hotkey I set accept suggestion to - it does nothing.

To Reproduce
Steps to reproduce the behaviour:

  1. Wait for a suggestion
  2. Press hotkey to accept
  3. Nothing happens

Expected behaviour

The selected hotkey should accept the suggestion

Screenshots

N/A

Obsidian and environment (please complete the following information):

  • OS: macOS 14.5
  • Obsidian version: 1.6.7
  • Plugin version [e.g. 1.0.0] : 1.0.10

Additional context

I've checked for clashing hotkeys and tried assigning it to many different combinations - none do anything.

Asked to restart sign-in process every day.

Describe the bug
The plugin asks me to restart the sign-in process every day. This does not seem to be based on me restarting Obsidian or rebooting my PC, but seems to be a daily occurance.

A related issue is that the notice pops up even when copilot is disabled (not the entire plugin, but by clicking the icon in the taskbar), repeatedly, every time I focus a different tab.

Expected behavior
It would be great if the rate of required re-sign-ins could be reduced, and if the notice that a new sign-in is necessary would appear only once.

Obsidian and environment (please complete the following information):

  • OS: Ubuntu jammy 22.04 x86_64
  • Obsidian version: v1.6.7
  • Plugin version [e.g. 1.0.0] : v1.0.10

On Windows 'Program Files' node path causes copilot fail

On windows node is located at: C:\Program Files\nodejs\node.exe

Providing this path to Node Binary Path results in successful test path test

However turning on plugin will result in error in dev console:

plugin:github-copilot:27023 stderr: 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Changing path to "C:\Program Files\nodejs\node.exe" (putting qoutes inside the field) will make plugin work however path test will fail.

Next suggestion

Is your feature request related to a problem? Please describe.
When writing prose, Copilot usually suggests more than one completion. Currently, I am getting only the first one, potentially missing out on other variants.

Describe the solution you'd like
A hotkey to see the next suggestion. Ideally, with being able to cycle between suggestions (one-way or two ways).

Last but not least, thank you for creating this plugin! The onboarding was super-smooth and it helps a lot with staying focused during writing. ๐Ÿ™Œ

Suggestions don't disappear when navigating with hjkl in vim mode

Describe the bug
Suggestions don't disappear when navigating with hjkl in vim mode

To Reproduce

  1. Activate the VIM keybindings
  2. Get a suggestion at the end of a line, then hit escape and move the cursor anywhere
  3. The stale suggestion moves along with the cursor wherever it goes

Expected behavior
The suggestion should be dismissed when moving away from the original position and potentially refresh at the new position

Screenshots
Bildschirmfoto 2024-07-30 um 11 44 29

Bildschirmfoto 2024-07-30 um 11 44 38

Obsidian and environment (please complete the following information):

  • OS: macOS
  • Obsidian version: 1.6.7
  • Plugin version: 1.0.6

Additional context
Great plugin, thanks!

Issued with Lists

First of all, this plugin is wonderful and is what I was looking for since I often reverted to editing markdown files in VSCode for the lack of Github Copilot integration in other tools.

One issue I have is that the Tab expansion is problematic in numbered or bulleted lists. Maybe something could be done?

Cursor IDE like Copilot

Hi @Pierrad

It's very cool how you did this. Excellent work!

I'm wondering whether you think it would be possible to do something similar with Cursor IDE.

๐ŸŒด

Next suggestion shortcut doesn't work on macOS

Describe the bug
A clear and concise description of what the bug is.

The shortcut should move to the next suggestion in the list. I tried many mappings, but none of them work.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'New note'
  2. Write text until multiple suggestions [eg. 1/2] appear.
  3. Press the Keyboard shortcut on macOS Sonoma
  4. See no change in suggestion

Expected behavior
A clear and concise description of what you expected to happen.
The shortcut should move to the next suggestion in the list without any issues.

Screenshots
If applicable, add screenshots to help explain your problem with console logs if possible.

Obsidian and environment (please complete the following information):

  • OS: macOS Sonoma 14.5
  • Obsidian version: Version 1.6.7
  • Plugin version [e.g. 1.0.0] : Version: 1.0.10

Additional context
Add any other context about the problem here.

Sign in modal not showing up on Arch Linux

Describe the bug
Sign in modal not showing up.

To Reproduce

  1. Go to 'settings'
  2. Click on 'restart sign-in process'

Expected behaviour
A modal is supposed to appear where I can sign in into my GitHub account.

Obsidian and environment (please complete the following information):

  • OS: Arch Linux
  • Obsidian version: 1.5.12
  • Plugin version : 1.0.2

Additional context
I fear this is more related to my OS than the plugin itself, however, often when this type of behaviour does not work on other applications, they provide a manual URL i can copy and paste into my browser. It'd be quite helpful if you could implement that for when the modal doesn't work.
A simple "Modal not showing up? Access ..." after clicking on 'restart sign-in process'.

Extension doesn't work on Flatpak installation

Hello i went through the manual installation and the settings/ the button to enable and disable at the bottom appeared as expected.
I added my node path "/usr/bin/node" but im still not getting any completion suggestions.

when opening the Console it shows an error being thrown at startup (Uncaught Error: write EPIPE)
obsidian.md-1715152018123.log

I also never received the ready to use notice stated in step 4 of the installation.

Any guidance on what to try from here?

Add copilot complete to suggestor instead of seperate logic.

Is your feature request related to a problem? Please describe.
Currently the complete suggestion are inline. Especially with tab being the default complete hotkey it has some weird handling of for example auto completing list elements (indent vs complete).

Describe the solution you'd like
I suggest a more robust handling of copilot auto complete like done in Copilot.lua with copilot-cmp.nvim, where the completions are injected in the auto-completion of the language server.

Now Obsidian doesn't have an auto-complete like this out of the box (with exceptions of file links and tags). But there is a very popular and actively maintained plugin called various complements: https://github.com/tadashi-aikawa/obsidian-various-complements-plugin

I think shifting the completions of copilot to be part of the various complements plugin allows for the most robust handling of the plugin with little to no chance for weird prioritization or conflicts of keybindings.

I know that this is a rather big feature request but I genuinely think it would drastically improve quality of life for any potential user.

Autosuggestion will follow my ๅ…‰ๆ ‡

Describe the bug
A clear and concise description of what the bug is.
Export-1718762938125

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
I hope the suggestion will disappear after the cursor position changes

Screenshots
If applicable, add screenshots to help explain your problem with console logs if possible.

Obsidian and environment (please complete the following information):

  • OS: 14.5 (23F79)
  • Obsidian version: 1.6.0
  • Plugin version [e.g. 1.0.0] : 1.0.7

Additional context
Add any other context about the problem here.

No Copilot Suggestions

Describe the bug
No Copilot Suggestions are appearing

To Reproduce
Steps to reproduce the behaviour:

  1. Enable Copilot
  2. Start typing

Expected behaviour
Suggestions should appear.

Obsidian and environment (please complete the following information):

  • OS: Arch Linux
  • Obsidian version: 1.5.12
  • Plugin version: 1.0.3

Additional context
On the logs, I get:

stdout: Content-Length: 92

{"jsonrpc":"2.0","id":3,"result":{"completions":[],"cancellationReason":"RequestCancelled"}}

every time I type a word.

(related to #15, I did not rename package.json back.)

HTTP Proxy Support

Hi! This plugin is amazing! Thank you very much for making it.

I need some help with configuring a proxy. In my IDE by JetBrains, there are settings to configure a proxy under "Settings" -> "Appearance & Behavior" -> "System settings" -> "HTTP Proxy", but I couldn't find similar options in the settings of this plugin.

Could you please help me figure out how to use a proxy with this plugin or consider adding a feature that allows users to configure an HTTP proxy directly within the plugin?

Exclude the path from Obsidian Sync

Currently, if you are using obsidian sync on multiple devices, syncing the path will result in issues, as the path will be different on each device.

Proposition is to store the path in a separate json file that will not be picked up by sync

Conflict with Latex Suite Plugin

Describe the bug

Open LaTeX Suite with Copilot plugin at the same time, and when you press the Tab key again it will not auto-complete but indent.

To Reproduce
Steps to reproduce the behavior:

  1. Installing the LaTeX Suite plug-in
  2. Press Tab while displaying Copilot's complement again

This plugin works FANTASTIC and I hope you can fix this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.