Syntax highlighting test

CREATE DISTRIBUTED QUERY pageRank (FLOAT maxChange, INT maxIter, FLOAT damping, BOOL display, INT outputLimit) FOR GRAPH social{
# Compute the pageRank score for each vertex in the GRAPH
# In each iteration, compute a score for each vertex:
#   score = (1-damping) + damping*sum(received scores FROM its neighbors).
# The pageRank algorithm stops when either of the following is true:
#  a) it reaches maxIter iterations;
#  b) the max score change for any vertex compared to the last iteration <= maxChange.

        TYPEDEF TUPLE<vertex Vertex_ID, FLOAT score> vertexScore;
        HeapAccum<vertexScore>(outputLimit, score DESC) @@topScores;
        MaxAccum<float> @@maxDiff = 9999; # max score change in an iteration
        SumAccum<float> @received_score = 0; # sum of scores each vertex receives FROM neighbors
        SumAccum<float> @score = 1;   # Initial score for every vertex is 1.
        SetAccum<EDGE> @@edgeSet;                   # list of all edges, if display is needed

        Start = {Person.*};   #  Start with all vertices of specified type(s)
        WHILE @@maxDiff > maxChange LIMIT maxIter DO
                @@maxDiff = 0;
                V = SELECT s
                    FROM Start:s -(Friend:e)-> :t
                    ACCUM t.@received_score += s.@score/(s.outdegree("Friend")) 
                    POST-ACCUM s.@score = (1.0-damping) + damping * s.@received_score,
                               s.@received_score = 0,
                               @@maxDiff += abs(s.@score - s.@score');
        END; # END WHILE loop

        IF outputLimit > 0 THEN
                V = SELECT s FROM Start:s
                    POST-ACCUM @@topScores += vertexScore(s, s.@score);
                PRINT @@topScores;

        IF display THEN
                PRINT Start[Start.@score];
                Start = SELECT s
                        FROM Start:s -(Friend:e)-> :t
                        ACCUM @@edgeSet += e;
                PRINT @@edgeSet;


Has anyone got syntax hiliting to work in Visual Studio Code?

@danmccreary Sample of GSQL syntax highlighting of the query above :point_up_2:

Here is a screenshot of the “EXTENSION”:

Looks awesome! I just installed it and it worked great!

1 Like