MCPcopy Create free account
hub / github.com/SplootCode/splootcode / generateTrayListForModule

Function generateTrayListForModule

scripts/pyright_tray_generate.ts:257–397  ·  view source on GitHub ↗
(
  structuredProgram: StructuredEditorProgram,
  moduleName: string,
  isStandardLib: boolean
)

Source from the content-addressed store, hash-verified

255}
256
257async function generateTrayListForModule(
258 structuredProgram: StructuredEditorProgram,
259 moduleName: string,
260 isStandardLib: boolean
261): Promise<PythonModuleInfo> {
262 console.log('Generating tray list for ' + moduleName)
263 let id = 1
264 const moduleNameNode: ModuleNameNode = {
265 nodeType: ParseNodeType.ModuleName,
266 id: id++,
267 start: 0,
268 length: 0,
269 leadingDots: 0,
270 nameParts: [
271 {
272 nodeType: ParseNodeType.Name,
273 id: id++,
274 start: 0,
275 length: 0,
276 value: moduleName,
277 token: {
278 type: TokenType.Identifier,
279 start: 0,
280 length: 0,
281 value: moduleName,
282 },
283 },
284 ],
285 }
286 moduleNameNode.nameParts[0].parent = moduleNameNode
287
288 const importNode: ImportNode = {
289 nodeType: ParseNodeType.Import,
290 id: id++,
291 start: 0,
292 length: 0,
293 list: [
294 {
295 nodeType: ParseNodeType.ImportAs,
296 id: id++,
297 start: 0,
298 length: 0,
299 module: moduleNameNode,
300 },
301 ],
302 }
303 importNode.list[0].parent = importNode
304 moduleNameNode.parent = importNode.list[0]
305
306 const nameNode: NameNode = {
307 nodeType: ParseNodeType.Name,
308 id: id++,
309 start: 0,
310 length: 0,
311 value: moduleName,
312 token: { type: TokenType.Identifier, start: 0, length: 0, value: moduleName },
313 }
314

Callers 1

mainFunction · 0.85

Calls 4

getShortDocFunction · 0.90
getAutocompleteInfoFunction · 0.90
generateSerializedNodeFunction · 0.85
writeFileSyncMethod · 0.80

Tested by

no test coverage detected