Skip to content

Commit

Permalink
Add immediate todos
Browse files Browse the repository at this point in the history
  • Loading branch information
kossnocorp committed Jan 17, 2025
1 parent bf1a876 commit a46ea99
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Genotype immediate TODOs

Currently I'm working on the workspaces feature. It will enable LSP and CLI watch mode.

At the moment the goal is to move modules parsing from the the project to the workspace crate and rework CLI to use it. It will allow building multiple projects from the same set of modules which is crucial for LSP.

- [ ] Figure out approach to [`source_code`](./parser/src/module/mod.rs:23) field in the `GTModule`.

It contains the path which must be relative to the currently active working directory to make it identify properly in editors, i.e. when using VS Code workspace feature. And since modules can be shared between projects, the path must differ depending on the context.

Another issue with it is that the source code is stored in the workspace and copying it to the module is a waste of memory.

The source code is needed to format parsing errors and it is easy to provide it when needed, rather than storing it in the module.

- [ ] Figure out approach to [`id`](./parser/src/module/mod.rs:13) field in the `GTModule`.

Currently the id is a module path without extension relative to the project. Since workspaces can contain multiple projects and share the same modules between them, it is better to make module ids relative to the workspace root.

A curve ball is that editors can open files from outside of the workspace and the module id should probably be an absolute path.

At the moment the module creates id from the string when parsing. It is better to move it outiside.
8 changes: 8 additions & 0 deletions parser/src/module/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ pub use resolve::*;

#[derive(Debug, PartialEq, Clone)]
pub struct GTModule {
/// Module identifier. Used to reference the module in the project.
pub id: GTModuleId,
/// Module source code.
// [TODO] Decide if I want to get rid of it and use source code from the outer context instead.
// The reason is that the source code contains the path that is rendered in the error messages,
// and that path to be correctly identified by editors, should be relative to the project
// working directory that can differ in different contexts i.e. depending on the active VS Code
// workspace project/folder.
#[deprecated]
pub source_code: NamedSource<String>,
pub doc: Option<GTDoc>,
pub imports: Vec<GTImport>,
Expand Down

0 comments on commit a46ea99

Please sign in to comment.