Question
· Apr 17

Modifying Visual Studio Code code assist results

Hi all,

I was wondering if there is a way to modify the results you get in the code assist in Visual Studio Code. Ideally even per class or package.

For example: the code below is for a custom component of a framework. From all the options listed I'm only interested in my own property "Title" and I don't want to see any %-methods or auto-generated methods like "TitleSet" and "TitleGet".

I have been looking at the %Api.Atelier classes, but it seems that it's only calling a list of deprecated methods when opening this list. So far I haven't been able to find any call where the rest of this list is being loaded.

Any help would be appreciated.

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.4 (Build 505_1U) Thu May 28 2020 10:01:40 EDT
Discussion (3)2
Log in or sign up to continue

I have found the solution in the meantime. The list is being generated by the Query ClassMethod in %Api.Atelier.v1. VSCode sends a request with an actual SQL query in the body which looks like this:

{
	"query": "SELECT Name, Description, Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases FROM %Dictionary.CompiledMethod WHERE parent->ID = ? AND classmethod = 0 AND Stub IS NULL AND ((Origin = parent->ID) OR (Origin != parent->ID AND NotInheritable = 0)) UNION ALL %PARALLEL SELECT {fn CONCAT(parent->name,Name)} AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases FROM %Dictionary.CompiledIndexMethod WHERE parent->parent->ID = ? AND classmethod = 0 UNION ALL %PARALLEL SELECT {fn CONCAT(parent->name,Name)} AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases FROM %Dictionary.CompiledQueryMethod WHERE parent->parent->ID = ? AND classmethod = 0 UNION ALL %PARALLEL SELECT {fn CONCAT(parent->name,Name)} AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases FROM %Dictionary.CompiledPropertyMethod WHERE parent->parent->ID = ? AND classmethod = 0 UNION ALL %PARALLEL SELECT {fn CONCAT(parent->name,Name)} AS Name, Description, parent->Origin AS Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases FROM %Dictionary.CompiledConstraintMethod WHERE parent->parent->ID = ? AND classmethod = 0 UNION ALL %PARALLEL SELECT Name, Description, Origin, NULL AS FormalSpec, RuntimeType AS Type, 'property' AS MemberType, Deprecated, Aliases FROM %Dictionary.CompiledProperty WHERE parent->ID = ?",
	"parameters": [
		"BO.Component.Window",
		"BO.Component.Window",
		"BO.Component.Window",
		"BO.Component.Window",
		"BO.Component.Window",
		"BO.Component.Window"
	]
}

I created a new class that overrides this ClassMethod and changed the /api/atelier web application to my own class.

The additional code:

if tQuery.query [ "SELECT Name, Description, Origin, FormalSpec, ReturnType AS Type, 'method' AS MemberType, Deprecated, NULL AS Aliases FROM %Dictionary.CompiledMethod" {
    s tQuery.query = $replace(tQuery.query, "Aliases ", "Aliases, Private ")
	s tQuery.query = "SELECT * FROM ("_tQuery.query_") WHERE (SUBSTRING(Name, 1, 1) != '%' AND Private = 0 AND (MemberType != 'method' OR (Name NOT LIKE '%Set' AND Name NOT LIKE '%Get' AND Name NOT LIKE '%GetObject' AND Name NOT LIKE '%GetObjectId' AND Name NOT LIKE '%GetSwizzled' AND Name NOT LIKE '%SetObject' AND Name NOT LIKE '%SetObjectId' AND Name NOT LIKE '%NewObject' AND Name NOT LIKE '%UnSwizzle')))"
}

I'm not super happy with this solution, but it's a start.