Skip to content

Commit

Permalink
Use origin instead of source
Browse files Browse the repository at this point in the history
User defined source can still be called 'source' I guess?
  • Loading branch information
kLabz committed Nov 26, 2022
1 parent 69d1550 commit 79f7a1c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/compiler/compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -617,4 +617,4 @@ module HighLevel = struct
in
let code = loop args in
comm.exit code
end
end
6 changes: 3 additions & 3 deletions src/core/define.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let get_define_key d =
match (infos d) with (s,_,_) -> s

let get_documentation d =
let t, (doc,flags), src = infos d in
let t, (doc,flags), origin = infos d in
let params = ref [] and pfs = ref [] in
List.iter (function
| HasParam s -> params := s :: !params
Expand All @@ -46,12 +46,12 @@ let get_documentation d =
| [] -> ""
| l -> "<" ^ String.concat ">, <" l ^ "> "
) in
let source = match src with
let origin = match origin with
| UserDefined Some s -> " (from " ^ s ^ ")"
| Compiler | UserDefined None -> ""
in
let pfs = platform_list_help (List.rev !pfs) in
(String.concat "-" (ExtString.String.nsplit t "_")), params ^ doc ^ pfs ^ source
(String.concat "-" (ExtString.String.nsplit t "_")), params ^ doc ^ pfs ^ origin

let get_documentation_list() =
let m = ref 0 in
Expand Down
8 changes: 4 additions & 4 deletions src/core/display/completionItem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ let to_json ctx index item =
]
| ITMetadata meta ->
let open Meta in
let name,(doc,params),src = Meta.get_info meta in
let name,(doc,params),origin = Meta.get_info meta in
let name = "@" ^ name in
let usage_to_string = function
| TClass -> "TClass"
Expand All @@ -773,7 +773,7 @@ let to_json ctx index item =
| TTypeParameter -> "TTypeParameter"
| TVariable -> "TVariable"
in
let source = match src with
let origin = match origin with
| Compiler -> Some "haxe compiler"
| UserDefined s -> s
in
Expand All @@ -794,7 +794,7 @@ let to_json ctx index item =
"targets",jlist jstring targets;
"internal",jbool internal;
"links",jlist jstring links;
"source",jopt jstring source;
"origin",jopt jstring origin;
]
| ITKeyword kwd ->"Keyword",jobject [
"name",jstring (s_keyword kwd)
Expand Down Expand Up @@ -833,4 +833,4 @@ let to_json ctx index item =
| Some t ->
("type",CompletionType.to_json ctx (snd t)) :: jindex
)
)
)
10 changes: 5 additions & 5 deletions src/core/meta.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type user_meta = {

let user_meta : (string, user_meta) Hashtbl.t = Hashtbl.create 0

type meta_source =
type meta_origin =
| Compiler
| UserDefined of string option

Expand Down Expand Up @@ -56,7 +56,7 @@ let from_string s =
| _ -> Custom s

let get_documentation d =
let t, (doc,flags), src = get_info d in
let t, (doc,flags), origin = get_info d in
if not (List.mem UsedInternally flags) then begin
let params = ref [] and used = ref [] and pfs = ref [] in
List.iter (function
Expand All @@ -71,12 +71,12 @@ let get_documentation d =
| l -> "(<" ^ String.concat ">, <" l ^ ">) "
) in
let pfs = platform_list_help (List.rev !pfs) in
let source = match src with
let origin = match origin with
| UserDefined Some s -> " (from " ^ s ^ ")"
| Compiler | UserDefined None -> ""
in
let str = "@" ^ t in
Some (str,params ^ doc ^ pfs ^ source)
Some (str,params ^ doc ^ pfs ^ origin)
end else
None

Expand Down Expand Up @@ -121,4 +121,4 @@ let get_user_documentation_list () =

let copy_from_to m src dst =
try (get m src) :: dst
with Not_found -> dst
with Not_found -> dst
1 change: 1 addition & 0 deletions std/haxe/display/Display.hx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ typedef Metadata = {
var parameters:Array<String>;
var platforms:Array<Platform>;
var targets:Array<MetadataTarget>;
var origin:String;
var internal:Bool;
var ?links:Array<String>;
}
Expand Down

0 comments on commit 79f7a1c

Please sign in to comment.