mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 18:08:55 +03:00
fmt
This commit is contained in:
parent
810c7dce80
commit
4828c9ba62
@ -1,4 +1,4 @@
|
||||
use roc_module::symbol::{IdentId};
|
||||
use roc_module::symbol::IdentId;
|
||||
use snafu::{Backtrace, Snafu};
|
||||
|
||||
use crate::lang::core::ast::ASTNodeId;
|
||||
|
@ -1,9 +1,7 @@
|
||||
use roc_module::symbol::IdentId;
|
||||
|
||||
use crate::{
|
||||
lang::core::{
|
||||
expr::{expr2::Expr2, expr2_to_string::expr2_to_string},
|
||||
},
|
||||
lang::core::expr::{expr2::Expr2, expr2_to_string::expr2_to_string},
|
||||
mem_pool::pool::{NodeId, Pool},
|
||||
};
|
||||
|
||||
|
@ -1,14 +1,10 @@
|
||||
use bumpalo::collections::Vec as BumpVec;
|
||||
use bumpalo::Bump;
|
||||
use roc_module::ident::{Ident, IdentStr};
|
||||
use roc_parse::{parser::SyntaxError};
|
||||
use roc_parse::parser::SyntaxError;
|
||||
use roc_region::all::Region;
|
||||
|
||||
use crate::lang::{
|
||||
core::{expr::expr_to_expr2::loc_expr_to_expr2},
|
||||
env::Env,
|
||||
scope::Scope,
|
||||
};
|
||||
use crate::lang::{core::expr::expr_to_expr2::loc_expr_to_expr2, env::Env, scope::Scope};
|
||||
|
||||
use super::def2::Def2;
|
||||
|
||||
|
@ -108,11 +108,11 @@ pub enum Expr2 {
|
||||
},
|
||||
Closure {
|
||||
args: PoolVec<(Variable, NodeId<Pattern2>)>, // 8B
|
||||
uniq_symbol: Symbol, // 8B This is a globally uniqe symbol for the function, not the name of the function
|
||||
body_id: ExprId, // 4B
|
||||
function_type: Variable, // 4B
|
||||
recursive: Recursive, // 1B
|
||||
extra: NodeId<ClosureExtra>, // 4B
|
||||
uniq_symbol: Symbol, // 8B This is a globally uniqe symbol for the function, not the name of the function
|
||||
body_id: ExprId, // 4B
|
||||
function_type: Variable, // 4B
|
||||
recursive: Recursive, // 1B
|
||||
extra: NodeId<ClosureExtra>, // 4B
|
||||
},
|
||||
// Product Types
|
||||
Record {
|
||||
|
@ -18,13 +18,13 @@ pub enum FunctionDef {
|
||||
arguments: PoolVec<(PatternId, Type2)>, // 8B
|
||||
rigids: NodeId<Rigids>, // 4B
|
||||
return_type: TypeId, // 4B
|
||||
body_id: ExprId, // 4B
|
||||
body_id: ExprId, // 4B
|
||||
},
|
||||
NoAnnotation {
|
||||
name: Symbol, // 8B
|
||||
arguments: PoolVec<(PatternId, Variable)>, // 8B
|
||||
return_var: Variable, // 4B
|
||||
body_id: ExprId, // 4B
|
||||
body_id: ExprId, // 4B
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -170,15 +170,14 @@ impl<'a> Env<'a> {
|
||||
}
|
||||
|
||||
pub fn get_name_for_ident_id(&self, ident_id: IdentId) -> ASTResult<&str> {
|
||||
Ok(
|
||||
self.ident_ids.get_name(ident_id).with_context(||
|
||||
IdentIdNotFound {
|
||||
ident_id,
|
||||
env_ident_ids_str: format!("{:?}", self.ident_ids),
|
||||
}
|
||||
)?
|
||||
Ok(self
|
||||
.ident_ids
|
||||
.get_name(ident_id)
|
||||
.with_context(|| IdentIdNotFound {
|
||||
ident_id,
|
||||
env_ident_ids_str: format!("{:?}", self.ident_ids),
|
||||
})?
|
||||
.as_inline_str()
|
||||
.as_str()
|
||||
)
|
||||
.as_str())
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,11 @@ pub fn new_colon_mn(expr_id: ExprId, parent_id_opt: Option<MarkNodeId>) -> Marku
|
||||
new_operator_mn(nodes::COLON.to_owned(), expr_id, parent_id_opt)
|
||||
}
|
||||
|
||||
pub fn new_operator_mn(content: String, expr_id: ExprId, parent_id_opt: Option<MarkNodeId>) -> MarkupNode {
|
||||
pub fn new_operator_mn(
|
||||
content: String,
|
||||
expr_id: ExprId,
|
||||
parent_id_opt: Option<MarkNodeId>,
|
||||
) -> MarkupNode {
|
||||
MarkupNode::Text {
|
||||
content: content,
|
||||
ast_node_id: ASTNodeId::AExprId(expr_id),
|
||||
|
@ -1,9 +1,17 @@
|
||||
use bumpalo::Bump;
|
||||
use roc_ast::{ast_error::ASTResult, lang::{core::ast::AST, env::Env}};
|
||||
use roc_ast::{
|
||||
ast_error::ASTResult,
|
||||
lang::{core::ast::AST, env::Env},
|
||||
};
|
||||
use roc_module::symbol::Interns;
|
||||
|
||||
use crate::{markup::{convert::{from_def2::def2_to_markup, from_header::header_to_markup}, nodes::set_parent_for_all}, slow_pool::{MarkNodeId, SlowPool}};
|
||||
|
||||
use crate::{
|
||||
markup::{
|
||||
convert::{from_def2::def2_to_markup, from_header::header_to_markup},
|
||||
nodes::set_parent_for_all,
|
||||
},
|
||||
slow_pool::{MarkNodeId, SlowPool},
|
||||
};
|
||||
|
||||
pub fn ast_to_mark_nodes<'a, 'b>(
|
||||
arena: &'a Bump,
|
||||
@ -25,4 +33,4 @@ pub fn ast_to_mark_nodes<'a, 'b>(
|
||||
}
|
||||
|
||||
Ok(all_mark_node_ids)
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,16 @@
|
||||
use crate::{markup::{common_nodes::new_blank_mn_w_nls, top_level_def::tld_mark_node}, slow_pool::{MarkNodeId, SlowPool}};
|
||||
use crate::{
|
||||
markup::{common_nodes::new_blank_mn_w_nls, top_level_def::tld_mark_node},
|
||||
slow_pool::{MarkNodeId, SlowPool},
|
||||
};
|
||||
|
||||
use super::{from_expr2::expr2_to_markup};
|
||||
use super::from_expr2::expr2_to_markup;
|
||||
|
||||
use bumpalo::Bump;
|
||||
use roc_ast::{
|
||||
ast_error::ASTResult,
|
||||
lang::{
|
||||
core::{
|
||||
ast::{ASTNodeId},
|
||||
ast::ASTNodeId,
|
||||
def::def2::{Def2, DefId},
|
||||
},
|
||||
env::Env,
|
||||
@ -37,16 +40,11 @@ pub fn def2_to_markup<'a, 'b>(
|
||||
*expr_id,
|
||||
mark_node_pool,
|
||||
interns,
|
||||
0
|
||||
0,
|
||||
)?;
|
||||
|
||||
let tld_mn = tld_mark_node(
|
||||
*identifier_id,
|
||||
expr_mn_id,
|
||||
ast_node_id,
|
||||
mark_node_pool,
|
||||
env
|
||||
)?;
|
||||
let tld_mn =
|
||||
tld_mark_node(*identifier_id, expr_mn_id, ast_node_id, mark_node_pool, env)?;
|
||||
|
||||
mark_node_pool.add(tld_mn)
|
||||
}
|
||||
@ -54,4 +52,4 @@ pub fn def2_to_markup<'a, 'b>(
|
||||
};
|
||||
|
||||
Ok(mark_node_id)
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,34 @@
|
||||
|
||||
use crate::{markup::{attribute::Attributes, common_nodes::{new_arg_name_mn, new_arrow_mn, new_blank_mn, new_colon_mn, new_comma_mn, new_equals_mn, new_left_accolade_mn, new_left_square_mn, new_operator_mn, new_right_accolade_mn, new_right_square_mn}, nodes::{MarkupNode, get_string, new_markup_node}}, slow_pool::{MarkNodeId, SlowPool}, syntax_highlight::HighlightStyle};
|
||||
use crate::{
|
||||
markup::{
|
||||
attribute::Attributes,
|
||||
common_nodes::{
|
||||
new_arg_name_mn, new_arrow_mn, new_blank_mn, new_colon_mn, new_comma_mn, new_equals_mn,
|
||||
new_left_accolade_mn, new_left_square_mn, new_operator_mn, new_right_accolade_mn,
|
||||
new_right_square_mn,
|
||||
},
|
||||
nodes::{get_string, new_markup_node, MarkupNode},
|
||||
},
|
||||
slow_pool::{MarkNodeId, SlowPool},
|
||||
syntax_highlight::HighlightStyle,
|
||||
};
|
||||
|
||||
use bumpalo::Bump;
|
||||
use itertools::Itertools;
|
||||
use roc_ast::{ast_error::{ASTResult, IdentIdNotFound}, lang::{core::{ast::ASTNodeId, expr::{
|
||||
use roc_ast::{
|
||||
ast_error::{ASTResult, IdentIdNotFound},
|
||||
lang::{
|
||||
core::{
|
||||
ast::ASTNodeId,
|
||||
expr::{
|
||||
expr2::{Expr2, ExprId},
|
||||
record_field::RecordField,
|
||||
}, pattern::{Pattern2, get_identifier_string}, val_def::ValueDef}, env::Env}};
|
||||
},
|
||||
pattern::{get_identifier_string, Pattern2},
|
||||
val_def::ValueDef,
|
||||
},
|
||||
env::Env,
|
||||
},
|
||||
};
|
||||
use roc_module::{ident::Ident, symbol::Interns};
|
||||
use snafu::OptionExt;
|
||||
|
||||
@ -20,7 +42,6 @@ pub fn expr2_to_markup<'a, 'b>(
|
||||
interns: &Interns,
|
||||
indent_level: usize,
|
||||
) -> ASTResult<MarkNodeId> {
|
||||
|
||||
let ast_node_id = ASTNodeId::AExprId(expr2_node_id);
|
||||
|
||||
println!("EXPR2 {:?}", expr2);
|
||||
@ -50,7 +71,7 @@ pub fn expr2_to_markup<'a, 'b>(
|
||||
mark_node_pool,
|
||||
indent_level,
|
||||
)
|
||||
},
|
||||
}
|
||||
Expr2::GlobalTag { name, .. } => new_markup_node(
|
||||
with_indent(indent_level, &get_string(env, name)),
|
||||
ast_node_id,
|
||||
@ -60,7 +81,15 @@ pub fn expr2_to_markup<'a, 'b>(
|
||||
),
|
||||
Expr2::Call { expr: expr_id, .. } => {
|
||||
let expr = env.pool.get(*expr_id);
|
||||
expr2_to_markup(arena, env, expr, *expr_id, mark_node_pool, interns, indent_level)?
|
||||
expr2_to_markup(
|
||||
arena,
|
||||
env,
|
||||
expr,
|
||||
*expr_id,
|
||||
mark_node_pool,
|
||||
interns,
|
||||
indent_level,
|
||||
)?
|
||||
}
|
||||
Expr2::Var(symbol) => {
|
||||
let text = env.get_name_for_ident_id(symbol.ident_id())?;
|
||||
@ -90,7 +119,7 @@ pub fn expr2_to_markup<'a, 'b>(
|
||||
*node_id,
|
||||
mark_node_pool,
|
||||
interns,
|
||||
indent_level
|
||||
indent_level,
|
||||
)?);
|
||||
|
||||
if idx + 1 < elems.len() {
|
||||
@ -154,7 +183,7 @@ pub fn expr2_to_markup<'a, 'b>(
|
||||
*sub_expr2_node_id,
|
||||
mark_node_pool,
|
||||
interns,
|
||||
indent_level
|
||||
indent_level,
|
||||
)?);
|
||||
}
|
||||
}
|
||||
@ -215,7 +244,7 @@ pub fn expr2_to_markup<'a, 'b>(
|
||||
*expr_id,
|
||||
mark_node_pool,
|
||||
interns,
|
||||
indent_level
|
||||
indent_level,
|
||||
)?;
|
||||
|
||||
let body_mn = mark_node_pool.get_mut(body_mn_id);
|
||||
@ -238,79 +267,67 @@ pub fn expr2_to_markup<'a, 'b>(
|
||||
}
|
||||
}
|
||||
}
|
||||
Expr2::Closure{
|
||||
function_type:_,
|
||||
uniq_symbol:_,
|
||||
recursive:_,
|
||||
Expr2::Closure {
|
||||
function_type: _,
|
||||
uniq_symbol: _,
|
||||
recursive: _,
|
||||
args,
|
||||
body_id,
|
||||
extra:_
|
||||
extra: _,
|
||||
} => {
|
||||
let backslash_mn = new_operator_mn("\\".to_string(), expr2_node_id, None);
|
||||
let backslash_mn_id = mark_node_pool.add(backslash_mn);
|
||||
|
||||
let arg_idents: Vec<&Ident> =
|
||||
args.iter(env.pool).map(
|
||||
| (_, arg_node_id) | {
|
||||
let arg_idents: Vec<&Ident> =
|
||||
args.iter(env.pool)
|
||||
.map(|(_, arg_node_id)| {
|
||||
let arg_pattern2 = env.pool.get(*arg_node_id);
|
||||
|
||||
match arg_pattern2 {
|
||||
Pattern2::Identifier(id_symbol) => {
|
||||
let ident_id = id_symbol.ident_id();
|
||||
let ident =
|
||||
env
|
||||
.ident_ids
|
||||
.get_name(ident_id)
|
||||
.with_context(|| IdentIdNotFound {
|
||||
ident_id,
|
||||
env_ident_ids_str: format!("{:?}", env.ident_ids),
|
||||
});
|
||||
let ident = env.ident_ids.get_name(ident_id).with_context(|| {
|
||||
IdentIdNotFound {
|
||||
ident_id,
|
||||
env_ident_ids_str: format!("{:?}", env.ident_ids),
|
||||
}
|
||||
});
|
||||
|
||||
ident
|
||||
},
|
||||
}
|
||||
other => {
|
||||
todo!("TODO: support the following pattern2 as function arg: {:?}", other);
|
||||
todo!(
|
||||
"TODO: support the following pattern2 as function arg: {:?}",
|
||||
other
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
.collect::<ASTResult<Vec<&Ident>>>()?;
|
||||
})
|
||||
.collect::<ASTResult<Vec<&Ident>>>()?;
|
||||
|
||||
let arg_names =
|
||||
arg_idents.iter().map(|ident| {
|
||||
ident.as_inline_str().as_str()
|
||||
});
|
||||
let arg_names = arg_idents
|
||||
.iter()
|
||||
.map(|ident| ident.as_inline_str().as_str());
|
||||
|
||||
let arg_mark_nodes =
|
||||
arg_names.map(|arg_name| new_arg_name_mn(arg_name.to_string(), expr2_node_id));
|
||||
|
||||
let commas = (0..(arg_mark_nodes.len() - 1)).map(|_| new_comma_mn(expr2_node_id, None));
|
||||
|
||||
let arg_mark_nodes = arg_names.map(
|
||||
|arg_name|
|
||||
new_arg_name_mn(arg_name.to_string(), expr2_node_id)
|
||||
);
|
||||
|
||||
let commas =
|
||||
(0..(arg_mark_nodes.len() - 1)).map(
|
||||
|_|
|
||||
new_comma_mn(expr2_node_id, None)
|
||||
);
|
||||
|
||||
let args_with_commas: Vec<MarkupNode> = arg_mark_nodes.interleave(commas).collect_vec();
|
||||
|
||||
let mut args_with_commas_ids: Vec<MarkNodeId> =
|
||||
args_with_commas.into_iter().map(
|
||||
|mark_node|
|
||||
mark_node_pool.add(mark_node)
|
||||
).collect();
|
||||
let mut args_with_commas_ids: Vec<MarkNodeId> = args_with_commas
|
||||
.into_iter()
|
||||
.map(|mark_node| mark_node_pool.add(mark_node))
|
||||
.collect();
|
||||
|
||||
let arrow_mn =
|
||||
new_arrow_mn(
|
||||
ASTNodeId::AExprId(expr2_node_id),
|
||||
1
|
||||
);
|
||||
let arrow_mn = new_arrow_mn(ASTNodeId::AExprId(expr2_node_id), 1);
|
||||
let arrow_mn_id = mark_node_pool.add(arrow_mn);
|
||||
|
||||
let mut children_ids = vec![backslash_mn_id];
|
||||
children_ids.append(&mut args_with_commas_ids);
|
||||
children_ids.push(arrow_mn_id);
|
||||
|
||||
|
||||
let args_mn = MarkupNode::Nested {
|
||||
ast_node_id: ASTNodeId::AExprId(expr2_node_id),
|
||||
children_ids,
|
||||
@ -327,7 +344,7 @@ pub fn expr2_to_markup<'a, 'b>(
|
||||
*body_id,
|
||||
mark_node_pool,
|
||||
interns,
|
||||
indent_level + 1
|
||||
indent_level + 1,
|
||||
)?;
|
||||
|
||||
let function_node = MarkupNode::Nested {
|
||||
@ -359,4 +376,4 @@ fn with_indent(indent_level: usize, some_str: &str) -> String {
|
||||
full_string.push_str(some_str);
|
||||
|
||||
full_string
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,17 @@
|
||||
use roc_ast::lang::core::{ast::ASTNodeId, expr::expr2::ExprId, header::AppHeader};
|
||||
|
||||
use crate::{markup::{attribute::Attributes, common_nodes::{new_comma_mn, new_left_accolade_mn, new_left_square_mn, new_right_accolade_mn, new_right_square_mn}, nodes::{MarkupNode, set_parent_for_all}}, slow_pool::{MarkNodeId, SlowPool}, syntax_highlight::HighlightStyle};
|
||||
|
||||
use crate::{
|
||||
markup::{
|
||||
attribute::Attributes,
|
||||
common_nodes::{
|
||||
new_comma_mn, new_left_accolade_mn, new_left_square_mn, new_right_accolade_mn,
|
||||
new_right_square_mn,
|
||||
},
|
||||
nodes::{set_parent_for_all, MarkupNode},
|
||||
},
|
||||
slow_pool::{MarkNodeId, SlowPool},
|
||||
syntax_highlight::HighlightStyle,
|
||||
};
|
||||
|
||||
pub fn header_to_markup(app_header: &AppHeader, mark_node_pool: &mut SlowPool) -> MarkNodeId {
|
||||
let expr_id = app_header.ast_node_id;
|
||||
@ -192,4 +202,4 @@ fn header_val_mn(
|
||||
};
|
||||
|
||||
mark_node_pool.add(mark_node)
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
pub mod from_ast;
|
||||
pub mod from_def2;
|
||||
pub mod from_expr2;
|
||||
pub mod from_header;
|
||||
pub mod from_header;
|
||||
|
@ -1,5 +1,5 @@
|
||||
pub mod attribute;
|
||||
pub mod common_nodes;
|
||||
pub mod nodes;
|
||||
pub mod convert;
|
||||
pub mod nodes;
|
||||
pub mod top_level_def;
|
||||
|
@ -4,12 +4,13 @@ use crate::{
|
||||
syntax_highlight::HighlightStyle,
|
||||
};
|
||||
|
||||
use super::{
|
||||
attribute::Attributes
|
||||
};
|
||||
use super::attribute::Attributes;
|
||||
|
||||
use crate::markup_error::{ExpectedTextNode, NestedNodeMissingChild, NestedNodeRequired};
|
||||
use roc_ast::{lang::{core::ast::ASTNodeId, env::Env}, mem_pool::pool_str::PoolStr};
|
||||
use roc_ast::{
|
||||
lang::{core::ast::ASTNodeId, env::Env},
|
||||
mem_pool::pool_str::PoolStr,
|
||||
};
|
||||
use roc_utils::{index_of, slice_get};
|
||||
use std::fmt;
|
||||
|
||||
@ -39,7 +40,7 @@ pub enum MarkupNode {
|
||||
ast_node_id: ASTNodeId,
|
||||
indent_level: usize,
|
||||
parent_id_opt: Option<MarkNodeId>,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
impl MarkupNode {
|
||||
@ -161,7 +162,9 @@ impl MarkupNode {
|
||||
MarkupNode::Nested { .. } => "".to_owned(),
|
||||
MarkupNode::Text { content, .. } => content.clone(),
|
||||
MarkupNode::Blank { .. } => BLANK_PLACEHOLDER.to_owned(),
|
||||
MarkupNode::Indent { indent_level, .. } => std::iter::repeat( SINGLE_INDENT).take(*indent_level).collect(),
|
||||
MarkupNode::Indent { indent_level, .. } => std::iter::repeat(SINGLE_INDENT)
|
||||
.take(*indent_level)
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,7 +297,7 @@ pub fn new_markup_node(
|
||||
let indent_node = MarkupNode::Indent {
|
||||
ast_node_id: node_id,
|
||||
indent_level,
|
||||
parent_id_opt: None
|
||||
parent_id_opt: None,
|
||||
};
|
||||
|
||||
let indent_node_id = mark_node_pool.add(indent_node);
|
||||
@ -359,7 +362,6 @@ pub fn set_parent_for_all_helper(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl fmt::Display for MarkupNode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
|
@ -1,10 +1,8 @@
|
||||
use roc_ast::{ast_error::{ASTResult}, lang::{
|
||||
core::{
|
||||
ast::ASTNodeId
|
||||
},
|
||||
env::Env,
|
||||
}};
|
||||
use roc_module::symbol::{IdentId};
|
||||
use roc_ast::{
|
||||
ast_error::ASTResult,
|
||||
lang::{core::ast::ASTNodeId, env::Env},
|
||||
};
|
||||
use roc_module::symbol::IdentId;
|
||||
|
||||
use crate::{
|
||||
markup::{attribute::Attributes, common_nodes::new_equals_mn, nodes::MarkupNode},
|
||||
@ -17,10 +15,9 @@ pub fn tld_mark_node<'a>(
|
||||
expr_mark_node_id: MarkNodeId,
|
||||
ast_node_id: ASTNodeId,
|
||||
mark_node_pool: &mut SlowPool,
|
||||
env: &Env<'a>
|
||||
env: &Env<'a>,
|
||||
) -> ASTResult<MarkupNode> {
|
||||
let val_name =
|
||||
env.get_name_for_ident_id(identifier_id)?;
|
||||
let val_name = env.get_name_for_ident_id(identifier_id)?;
|
||||
|
||||
let val_name_mn = MarkupNode::Text {
|
||||
content: val_name.to_owned(),
|
||||
|
@ -137,7 +137,12 @@ fn run_event_loop(project_dir_path_opt: Option<&Path>) -> Result<(), Box<dyn Err
|
||||
let dep_idents = IdentIds::exposed_builtins(8);
|
||||
let exposed_ident_ids = IdentIds::default();
|
||||
let module_ids = loaded_module.interns.module_ids.clone();
|
||||
let all_ident_ids = loaded_module.interns.all_ident_ids.get(&loaded_module.module_id).unwrap().clone(); //TODO remove unwrap
|
||||
let all_ident_ids = loaded_module
|
||||
.interns
|
||||
.all_ident_ids
|
||||
.get(&loaded_module.module_id)
|
||||
.unwrap()
|
||||
.clone(); //TODO remove unwrap
|
||||
|
||||
let env = Env::new(
|
||||
loaded_module.module_id,
|
||||
|
@ -242,8 +242,13 @@ pub mod test_ed_model {
|
||||
&mut ed_model_refs.var_store,
|
||||
dep_idents,
|
||||
module_ids,
|
||||
loaded_module.interns.all_ident_ids.get(&loaded_module.module_id).unwrap().clone(),
|
||||
exposed_ident_ids
|
||||
loaded_module
|
||||
.interns
|
||||
.all_ident_ids
|
||||
.get(&loaded_module.module_id)
|
||||
.unwrap()
|
||||
.clone(),
|
||||
exposed_ident_ids,
|
||||
);
|
||||
|
||||
ed_model::init_model(
|
||||
|
@ -1,12 +1,6 @@
|
||||
use roc_ast::{
|
||||
lang::{
|
||||
core::{
|
||||
ast::ASTNodeId,
|
||||
def::def2::Def2,
|
||||
expr::expr2::Expr2,
|
||||
},
|
||||
env::Env,
|
||||
},
|
||||
use roc_ast::lang::{
|
||||
core::{ast::ASTNodeId, def::def2::Def2, expr::expr2::Expr2},
|
||||
env::Env,
|
||||
};
|
||||
use roc_code_markup::{
|
||||
markup::{
|
||||
@ -17,7 +11,7 @@ use roc_code_markup::{
|
||||
slow_pool::{MarkNodeId, SlowPool},
|
||||
syntax_highlight::HighlightStyle,
|
||||
};
|
||||
use roc_module::symbol::{IdentId};
|
||||
use roc_module::symbol::IdentId;
|
||||
|
||||
use crate::{
|
||||
editor::ed_error::{EdResult, FailedToUpdateIdentIdName, KeyNotFound},
|
||||
@ -37,7 +31,7 @@ pub fn tld_mark_node<'a>(
|
||||
expr_mark_node_id: MarkNodeId,
|
||||
ast_node_id: ASTNodeId,
|
||||
mark_node_pool: &mut SlowPool,
|
||||
env: &Env<'a>
|
||||
env: &Env<'a>,
|
||||
) -> EdResult<MarkupNode> {
|
||||
let val_name = env.get_name_for_ident_id(identifier_id)?;
|
||||
|
||||
@ -108,7 +102,7 @@ pub fn start_new_tld_value(ed_model: &mut EdModel, new_char: &char) -> EdResult<
|
||||
val_expr_mn_id,
|
||||
ast_node_id,
|
||||
&mut ed_model.mark_node_pool,
|
||||
&ed_model.module.env
|
||||
&ed_model.module.env,
|
||||
)?;
|
||||
|
||||
let new_ast_node = Def2::ValueDef {
|
||||
|
@ -3,7 +3,7 @@ use crate::editor::{ed_error::EdResult, theme::EdTheme, util::map_get};
|
||||
use crate::graphics::primitives::rect::Rect;
|
||||
use crate::graphics::primitives::text as gr_text;
|
||||
use cgmath::Vector2;
|
||||
use roc_code_markup::markup::nodes::{BLANK_PLACEHOLDER, MarkupNode, SINGLE_INDENT};
|
||||
use roc_code_markup::markup::nodes::{MarkupNode, BLANK_PLACEHOLDER, SINGLE_INDENT};
|
||||
use roc_code_markup::slow_pool::{MarkNodeId, SlowPool};
|
||||
use roc_code_markup::syntax_highlight::HighlightStyle;
|
||||
use winit::dpi::PhysicalSize;
|
||||
@ -157,7 +157,8 @@ fn markup_to_wgpu_helper<'a>(
|
||||
.with_color(colors::to_slice(colors::WHITE))
|
||||
.with_scale(code_style.font_size);
|
||||
|
||||
let highlight_color = map_get(&code_style.ed_theme.syntax_high_map, &HighlightStyle::Blank)?;
|
||||
let highlight_color =
|
||||
map_get(&code_style.ed_theme.syntax_high_map, &HighlightStyle::Blank)?;
|
||||
|
||||
let char_width = code_style.glyph_dim_rect.width;
|
||||
let char_height = code_style.glyph_dim_rect.height;
|
||||
@ -193,7 +194,7 @@ fn markup_to_wgpu_helper<'a>(
|
||||
.with_color(colors::to_slice(colors::WHITE))
|
||||
.with_scale(code_style.font_size);
|
||||
|
||||
wgpu_texts.push(glyph_text);
|
||||
wgpu_texts.push(glyph_text);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user