Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puts MeTTaLog runtime into LSP Server #111

Merged
merged 6 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions hyperon-wam.vpj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@
<F N=".github/workflows/ci.yml"/>
</Folder>
</Folder>
<Folder Name="../.vscode">
<Folder Name="extensions">
<Folder Name="royward.metta-lsp-0.0.2">
<F
N="../.vscode/extensions/royward.metta-lsp-0.0.2/*.*"
Recurse="1"
Excludes=".git/;*.metta.html;*.bak;build/"
L="1"/>
</Folder>
</Folder>
</Folder>
<Folder Name="docs">
<F
N="docs/*.*"
Expand All @@ -115,8 +126,7 @@
<F
N="../hyperon-experimental/*.*"
Recurse="1"
Excludes=".git/;*.metta.html;*.bak;build/;.*/;*~*/"
L="1"/>
Excludes=".git/;*.metta.html;*.bak;build/;.*/;*~*/"/>
</Folder>
<Folder Name="library">
<F
Expand Down
2 changes: 1 addition & 1 deletion hyperon-wam.vpw
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd">
<Workspace Version="10.0" VendorName="SlickEdit">
<Projects>
<Project File="compiler-project.vpj"/>
<Project File="Compiler-project.vpj"/>
<Project File="hyperon-experimental.vpj"/>
<Project File="hyperon-wam.vpj"/>
<Project File="Test-files.vpj"/>
Expand Down
19 changes: 15 additions & 4 deletions src/canary/metta_interp.pl
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@

:- meta_predicate fake_notrace(0).
fake_notrace(G):- tracing,!,real_notrace(G).
fake_notrace(G):- !,notrace(G).
fake_notrace(G):- !,once(G).
% `quietly/1` allows breaking in and inspection (real `no_trace/1` does not)
fake_notrace(G):- quietly(G),!.
Expand Down Expand Up @@ -582,7 +583,11 @@



mettalog_rt_args(Args):- current_prolog_flag(mettalog_rt_args, Args),!.
mettalog_rt_args(['--repl=false']).

metta_argv(Args):- current_prolog_flag(metta_argv, Args),!.
metta_argv(Args):- current_prolog_flag(mettalog_rt, true),!,mettalog_rt_args(Args).
metta_argv(Before):- current_prolog_flag(os_argv,OSArgv), append(_,['--args'|AArgs],OSArgv),
before_arfer_dash_dash(AArgs,Before,_),!,set_metta_argv(Before).
argv_metta(Nth,Value):- metta_argv(Args),nth1(Nth,Args,Value).
Expand All @@ -591,6 +596,8 @@
read_argv(AArg,Arg):- \+ symbol(AArg),!,AArg=Arg.
read_argv(AArg,Arg):- atom_string(AArg,S),read_metta(S,Arg),!.


metta_cmd_args(Args):- current_prolog_flag(mettalog_rt, true),!,mettalog_rt_args(Args).
metta_cmd_args(Rest):- current_prolog_flag(late_metta_opts,Rest),!.
metta_cmd_args(Rest):- current_prolog_flag(os_argv,P),append(_,['--'|Rest],P),!.
metta_cmd_args(Rest):- current_prolog_flag(argv,P),append(_,['--'|Rest],P),!.
Expand Down Expand Up @@ -1015,10 +1022,13 @@
%metta_atom(KB,Atom):- KB=='&corelib',!, metta_atom_corelib(Atom).
metta_atom(KB,Atom):- metta_atom_in_file( KB,Atom).
metta_atom(KB,Atom):- metta_atom_asserted( KB,Atom).
metta_atom(KB,Atom):- KB \== '&corelib', !, should_inherit_from_corelib(Atom), metta_atom('&corelib',Atom).
should_inherit_from_corelib([H|_]):- nonvar(H),should_inherit_op_from_corelib(H).
metta_atom(KB,Atom):- KB \== '&corelib', !,
\+ \+ (metta_atom_asserted(KB,'&corelib');should_inherit_from_corelib(Atom)), !, metta_atom('&corelib',Atom).
should_inherit_from_corelib([H|_]):- nonvar(H), \+ \+ should_inherit_op_from_corelib(H).
should_inherit_op_from_corelib('=').
should_inherit_op_from_corelib(':').
should_inherit_op_from_corelib('@doc').
should_inherit_op_from_corelib(_).

metta_atom_asserted('&self','&corelib').
metta_atom_asserted('&self','&stdlib').
Expand Down Expand Up @@ -1619,7 +1629,7 @@
maplist(catch_red_ignore,[

%if_t(is_compiled,ensure_mettalog_py),
install_readline_editline,
install_readline_editline,
%nts1,
%install_ontology,
metta_final,
Expand Down Expand Up @@ -1653,7 +1663,7 @@
maybe_halt(Seven):- option_value('halt',true),!,halt(Seven).
maybe_halt(_):- once(pre_halt2), fail.
maybe_halt(Seven):- fbugio(maybe_halt(Seven)), fail.
%maybe_halt(_):- !.
maybe_halt(_):- current_prolog_flag(mettalog_rt,true),!.
maybe_halt(H):- halt(H).


Expand Down Expand Up @@ -1792,6 +1802,7 @@
use_corelib_file,
(is_testing -> UNIT_TEST=true; UNIT_TEST=false),
set_is_unit_test(UNIT_TEST),
%trace,
\+ prolog_load_context(reloading,true),
initialization(loon(restore),restore),
% nts1,
Expand Down
Loading