Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Feel-ix-343/obsidian-markdown-ls
Browse files Browse the repository at this point in the history
  • Loading branch information
Feel-ix-343 committed Feb 26, 2024
2 parents 084b9a9 + ed2e7ba commit 16a62ae
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 23 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/github-repo-stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: github-repo-stats

on:
schedule:
# Run this once per day, towards the end of the day for keeping the most
# recent data point most meaningful (hours are interpreted in UTC).
- cron: "0 23 * * *"
workflow_dispatch: # Allow for running this manually.

jobs:
j1:
name: github-repo-stats
runs-on: ubuntu-latest
steps:
- name: run-ghrs
# Use latest release.
uses: jgehrcke/github-repo-stats@RELEASE
with:
ghtoken: ${{ secrets.ghrs_github_api_token }}

22 changes: 22 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
63 changes: 40 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,80 @@

Implementing obsidian PKM features (and possibly more) in the form of a language server allows us to use these features in our favorite text editors and reuse other lsp related plugins (like Telescope, outline, refactoring tools, ...)

## Usage
## Installation

> [!IMPORTANT]
> I'm working on getting this into package distributions. Installation/configuration should be easier soon.

### Arch Linux

If you are using Arch Linux, you can install the latest Git version through the AUR. The package name is `markdown-oxide-git`. You can install it using your preferred AUR helper; for example:

```sh
paru -S markdown-oxide-git
```

### Manual

==I am trying to get this into package distributions right now!!! This should be easier soon==
Clone the repository and then run `cargo build --release`.

First, compile the plugin. Clone the repo and then run `cargo build --release`
## Usage

Next, follow the directions for your editor
To use the language server, you need to follow the instructions for your editor of choice below.

### VSCode

Go to [the vscode extension readme](./vscode-extension/README.md) and run the commands listed
Go to [the VSCode extension readme](./vscode-extension/README.md) and run the commands listed

### Neovim

Make sure rust is installed properly and that you are using nvim cmp (I am not sure if it works in other completion engines)

Adjust your neovim config as follows

```
```lua
local lspconfig = require('lspconfig')
local configs = require("lspconfig.configs")
configs["obsidian_ls"] = {
default_config = {
root_dir = function() return vim.fn.getcwd() end,
filetypes = {"markdown"},
cmd = {"{path}"} -- replace {path} with the path to the --release build.
-- {path} will be {where ever you cloned from}/obsidian-ls/target/release/markdown-oxide
},
on_attach = on_attach, -- do this only if you have an on_attach function already

configs["markdown_oxide"] = {
default_config = {
root_dir = lspconfig.util.root_pattern('.git', vim.fn.getcwd()),
filetypes = {"markdown"},
cmd = {"markdown-oxide"} -- This needs to be the path to the markdown-oxide binary, either in your PATH or the full absolute path.
},
on_attach = on_attach, -- do this only if you have an on_attach function already
}
require("lspconfig").obsidian_ls.setup({

require("lspconfig").markdown_oxide.setup({
capabilities = capabilities -- ensure that capabilities.workspace.didChangeWatchedFiles.dynamicRegistration = true
})
```

then adjust your nvim-cmp source settings for the following. Note that this will likely change in the future.

```
```lua
{
name = 'nvim_lsp',
option = {
obsidian_ls = {
keyword_pattern = [[\(\k\| \|\/\|#\)\+]]
}
}
name = 'nvim_lsp',
option = {
markdown_oxide = {
keyword_pattern = [[\(\k\| \|\/\|#\)\+]]
}
}
},
```


I also recommend enabling codelens in neovim. Add this snippet to your on\_attach function for nvim-lspconfig


```
```lua
-- refresh codelens on TextChanged and InsertLeave as well
vim.api.nvim_create_autocmd({ 'TextChanged', 'InsertLeave', 'CursorHold', 'LspAttach' }, {
buffer = bufnr,
callback = vim.lsp.codelens.refresh,
})

-- trigger codelens refresh
vim.api.nvim_exec_autocmds('User', { pattern = 'LspAttached' })
```
Expand Down

0 comments on commit 16a62ae

Please sign in to comment.