Skip to content

Commit

Permalink
Mkarimi/system types link (#141)
Browse files Browse the repository at this point in the history
* Fix outgoing links from datatypes

* Return correct type if param type is namespaced

* Use correct system types
  • Loading branch information
karimi authored Oct 8, 2024
1 parent 352fa46 commit 5357dcf
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 41 deletions.
32 changes: 28 additions & 4 deletions quasar_site/src/components/MemberSignature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,34 @@ export default {
let link = tokenPath ? this.baseUrl + tokenPath : null
//Try to get system links
if(!link){
if( typeToken.toLowerCase().startsWith("system")){
let cleanType = typeToken.split("<")[0];
cleanType = cleanType.split("[")[0];
link = `https://learn.microsoft.com/en-us/dotnet/api/${cleanType}`
// if( typeToken.toLowerCase().startsWith("system")){
// let cleanType = typeToken.split("<")[0];
// cleanType = cleanType.split("[")[0];
// link = `https://learn.microsoft.com/en-us/dotnet/api/${cleanType}`
// }
const standardCSharpTypes = {
"int": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types",
"string": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types#the-string-type",
"bool": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool",
"double": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types",
"float": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types",
"decimal": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types",
"char": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/char",
"byte": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types",
"void": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/void",
"object": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types#the-object-type",
"DateTime": "https://learn.microsoft.com/en-us/dotnet/api/system.datetime",
"uint": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types",
"sbyte": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types",
"short": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types",
"ushort": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types",
"long": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types",
"ulong": "https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types",
// Add more standard types as needed
};
if (!link && standardCSharpTypes[typeToken]) {
link = standardCSharpTypes[typeToken];
}
}
// console.log(`returning link for ${typeToken} path: ${tokenPath}`, link)
Expand Down
2 changes: 1 addition & 1 deletion src/Parse/JsonBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ static string MemberAsJsonArray(ParsedMember member, bool asJavascript = true)
//sb.Append($" deprecated: '{deprecated}'");
}

if (member.Signature(false).Contains("Plane EquitorialPlane")){
if (member.Signature(false).Contains("explodeNestedInstances")){
var inspecting = member;
}
string remarks = member.Remarks();
Expand Down
71 changes: 36 additions & 35 deletions src/Parse/ParsedMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,41 +87,42 @@ public string FullTypeName(string shortName)
shortName = shortName.Substring(0, shortName.Length - 1);
}

switch (shortName)
{
case "int":
return typeof(int).FullName + suffix;
case "bool":
return typeof(bool).FullName + suffix;
case "float":
return typeof(float).FullName + suffix;
case "double":
return typeof(double).FullName + suffix;
case "string":
return typeof(string).FullName + suffix;
case "void":
return typeof(void).FullName + suffix;
case "uint":
return typeof(uint).FullName + suffix;
case "object":
return typeof(object).FullName + suffix;
case "byte":
return typeof(byte).FullName + suffix;
case "sbyte":
return typeof(sbyte).FullName + suffix;
case "short":
return typeof(short).FullName + suffix;
case "ushort":
return typeof(ushort).FullName + suffix;
case "long":
return typeof(long).FullName + suffix;
case "ulong":
return typeof(ulong).FullName + suffix;
case "char":
return typeof(char).FullName + suffix;
default:
return shortName;
}
// switch (shortName)
// {
// case "int":
// return typeof(int).FullName + suffix;
// case "bool":
// return typeof(bool).FullName + suffix;
// case "float":
// return typeof(float).FullName + suffix;
// case "double":
// return typeof(double).FullName + suffix;
// case "string":
// return typeof(string).FullName + suffix;
// case "void":
// return typeof(void).FullName + suffix;
// case "uint":
// return typeof(uint).FullName + suffix;
// case "object":
// return typeof(object).FullName + suffix;
// case "byte":
// return typeof(byte).FullName + suffix;
// case "sbyte":
// return typeof(sbyte).FullName + suffix;
// case "short":
// return typeof(short).FullName + suffix;
// case "ushort":
// return typeof(ushort).FullName + suffix;
// case "long":
// return typeof(long).FullName + suffix;
// case "ulong":
// return typeof(ulong).FullName + suffix;
// case "char":
// return typeof(char).FullName + suffix;
// default:
// return shortName;
// }
return shortName;
}

if (_usingDirectives!=null)
Expand Down
2 changes: 1 addition & 1 deletion src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void Docify(string projDir, string examplesDir, string outputDir)
continue;
if (!parsedItem.IsPublic && !parsedItem.IsProtected)
continue;
if (parsedItem.Signature(false).Contains("KeyboardHookEvent(int key)")){
if (parsedItem.Signature(false).Contains("explodeNestedInstances")){
var inspecting = parsedItem;
}
string className = parsedItem.ClassPath;
Expand Down

0 comments on commit 5357dcf

Please sign in to comment.