Skip to content

Commit c6a84bc

Browse files
committed
Add Python to languages supported by codemarkup for SCIP
Test Plan: Index some Python code with `glean index python-scip` Then query for `codemarkup.FileEntityLocations _`. Before it produced nothing, after this diff it produces results.
1 parent b850312 commit c6a84bc

4 files changed

Lines changed: 7 additions & 0 deletions

File tree

glean/glass/Glean/Glass/SymbolId.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ instance Symbol Code.Entity where
352352
Scip.Entity_java se -> toSymbolWithPath se p
353353
Scip.Entity_kotlin se -> toSymbolWithPath se p
354354
Scip.Entity_swift se -> toSymbolWithPath se p
355+
Scip.Entity_python se -> toSymbolWithPath se p
355356
Scip.Entity_EMPTY -> throwM $ SymbolError "Unknown SCIP language"
356357

357358
_ -> throwM $ SymbolError "Language not supported"
@@ -411,6 +412,7 @@ entityToAngle e = case e of
411412
Scip.Entity_java x -> Right $ alt @"java" (toAngle x)
412413
Scip.Entity_kotlin x -> Right $ alt @"kotlin" (toAngle x)
413414
Scip.Entity_swift x -> Right $ alt @"swift" (toAngle x)
415+
Scip.Entity_python x -> Right $ alt @"python" (toAngle x)
414416
Scip.Entity_EMPTY -> Left "toAngle: Unknown SCIP language"
415417

416418
_ -> Left $
@@ -454,6 +456,7 @@ instance ToQName Code.Entity where
454456
Scip.Entity_java x -> toQName x
455457
Scip.Entity_kotlin x -> toQName x
456458
Scip.Entity_swift x -> toQName x
459+
Scip.Entity_python x -> toQName x
457460
Scip.Entity_EMPTY -> pure $ Left "SCIP: language unsupported"
458461
_ -> pure $ Left ("Language unsupported: " <> textShow (entityLanguage e))
459462

glean/glass/Glean/Glass/SymbolSig.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ instance ToSymbolSignature Code.Entity where
147147
Scip.Entity_java x -> SCIP.prettyScipSignature opts x
148148
Scip.Entity_kotlin x -> SCIP.prettyScipSignature opts x
149149
Scip.Entity_swift x -> SCIP.prettyScipSignature opts x
150+
Scip.Entity_python x -> SCIP.prettyScipSignature opts x
150151
Scip.Entity_EMPTY -> pure Nothing
151152
-- lsif languages, just enumerate completely to stay total
152153
Code.Entity_lsif e -> case e of

glean/schema/source/code.scip.angle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type Entity =
1212
java : scip.SomeEntity |
1313
kotlin : scip.SomeEntity |
1414
swift: scip.SomeEntity |
15+
python: scip.SomeEntity |
1516
}
1617

1718
type SymbolId = scip.Symbol

glean/schema/source/scip.angle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ type Entity =
194194
java: SomeEntity |
195195
kotlin: SomeEntity |
196196
swift: SomeEntity |
197+
python: SomeEntity |
197198
}
198199

199200
# entities are scip.Definitions
@@ -216,6 +217,7 @@ predicate TagDefinition:
216217
( TypeScript = Language; { typescript = SomeEntity }) |
217218
( Swift = Language; { swift = SomeEntity }) |
218219
( Java = Language; { java = SomeEntity }) |
220+
( Python = Language; { python = SomeEntity }) |
219221
( Kotlin = Language; { kotlin = SomeEntity }) = Entity;
220222

221223
# eliminate entity language tags. inverse of TagDefinition

0 commit comments

Comments
 (0)