-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement LSP functions in Rust (#477)
* Refactor formulas * Reorder formula functions to match official docs * Add some missing formula documentation * Documentation is now included alongside function definitions, so we can auto-generate formula function documentation soon * Add examples for all formula functions * Add `parse_formula()` wasm function * Expose `column_name` and `column_from_name` to JS * Implement LSP autocomplete via Rust * Replace `CELL` with Excel-compatible `INDIRECT` * Make grid access async so it should actually work now * Autogenerate Notion docs for formulas quadratic-core internal changes: * Add macro for JS value manipulation * Add `col!` and `pos!` macros
- Loading branch information
Showing
18 changed files
with
415 additions
and
109 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Quadratic Core | ||
|
||
This contains the Rust code that powers Quadratic's client via WASM. | ||
|
||
## Formula function documentation | ||
|
||
Documentation for formula functions can be found in next to the Rust implementation of each function, in `src/formulas/functions/*.rs`. (`mod.rs` and `util.rs` do not contain any functions.) | ||
|
||
### Rebuilding formula function documentation | ||
|
||
Run `cargo run --bin docgen`, then copy/paste from `formula_docs_output.md` into Notion. Copying from VSCode will include formatting, so you may have to first paste it into a plaintext editor like Notepad, then copy/paste from there into Notion. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use itertools::Itertools; | ||
|
||
const OUT_FILENAME: &str = "formula_docs_output.md"; | ||
|
||
fn main() { | ||
let mut output = String::new(); | ||
|
||
for category in quadratic_core::formulas::functions::CATEGORIES { | ||
if !category.include_in_docs { | ||
continue; | ||
} | ||
|
||
output.push_str(&format!("## {}\n\n", category.name)); | ||
output.push_str(category.docs); | ||
|
||
// Table header. | ||
output.push_str("| **Function** | **Description** |\n"); | ||
output.push_str("| ------------ | --------------- |\n"); | ||
for func in (category.get_functions)() { | ||
let usages = func.usages_strings().map(|s| format!("`{s}`")).join("; "); | ||
let doc = func.doc.replace('\n', " "); | ||
output.push_str(&format!("| {usages} | {doc} |\n")); | ||
} | ||
output.push('\n'); | ||
} | ||
|
||
std::fs::write(OUT_FILENAME, output).expect("failed to write to output file"); | ||
|
||
println!("Docs were written to {OUT_FILENAME}. No need to check this file into git.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2326f96
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.
Successfully deployed to the following URLs:
quadratic – ./
quadratic-nu.vercel.app
quadratic-git-main-quadratic.vercel.app
quadratic-quadratic.vercel.app