Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ async function listDeps(cwd: string, targets: Targets, query: string) {
}

export { Targets } from './targets';
export { TargetsLanguageProvider } from './targets/languages';
export { MakeProject } from './builders/make';
export { BobProject } from "./builders/bob";
export { ImpactMarkdown } from "./builders/imd"
Expand Down
5 changes: 5 additions & 0 deletions cli/src/targets/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export class TargetsLanguageProvider {
return `**/*.{${allExtensions.join(`,`)},${allExtensions.map(e => e.toUpperCase()).join(`,`)}}`;
}

public static getStandardGlob() {
const allExtensions = [...clExtensions, ...sqlExtensions, ...ddsExtension, ...binderExtensions, ...cmdExtensions, ...rpgExtensions];
return `**/*.{${allExtensions.join(`,`)},${allExtensions.map(e => e.toUpperCase()).join(`,`)}}`;
}

public async handleLanguage(relativePath: string, content: string, options: FileOptions = {}) {
const ext = relativePath.split('.').pop()?.toLowerCase();
const language = this.languageTargets.find(lang => lang.extensions.includes(ext));
Expand Down
2 changes: 1 addition & 1 deletion vs/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vs/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 19 additions & 24 deletions vs/server/src/TargetsManager.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/* eslint-disable no-case-declarations */

import { Targets, allExtensions } from "@ibm/sourceorbit";
import { Targets } from "@ibm/sourceorbit";
import { ILEObject } from "@ibm/sourceorbit/dist/src/targets";

import { URI } from 'vscode-uri';
import { ReadFileSystem } from './readFileSystem';

import path = require("path");

export const SupportedGlob = `**/*.{${allExtensions.join(`,`)}}`;

export class TargetsManager {
private static projects: { [workspacePath: string]: Targets | undefined } = {};

Expand Down Expand Up @@ -45,11 +43,12 @@ export class TargetsManager {
const url = uri.fsPath;

const rfs = new ReadFileSystem();
const files = await rfs.getFiles(url, SupportedGlob);

const targets = new Targets(url, rfs);

targets.loadObjectsFromPaths(files);
const files = await rfs.getFiles(url, targets.getSearchGlob());

await targets.loadObjectsFromPaths(files);

await Promise.allSettled(files.map(f => targets.parseFile(f)));

Expand All @@ -75,14 +74,12 @@ export class TargetsManager {
if (pathDetail.ext.length > 1) {
const ext = pathDetail.ext.substring(1).toLowerCase();

if (allExtensions.includes(ext)) {
const targets = this.getTargetsForFile(uriString);
const targets = this.getTargetsForFile(uriString);

if (targets) {
return targets.parseFile(uri.fsPath);
if (targets) {
return targets.parseFile(uri.fsPath);

// TODO: think about re-resolving later if changing a module?
}
// TODO: think about re-resolving later if changing a module?
}
}
}
Expand All @@ -95,24 +92,22 @@ export class TargetsManager {
if (pathDetail.ext.length > 1) {
const ext = pathDetail.ext.substring(1);

if (allExtensions.includes(ext)) {
const targets = this.getTargetsForFile(uriString);
const targets = this.getTargetsForFile(uriString);

if (targets) {
const impacted = targets.removeObjectByPath(uri.fsPath);
if (targets) {
const impacted = targets.removeObjectByPath(uri.fsPath);

if (impacted.length > 0) {
const cwd = this.getWorkspaceFolder(uri.fsPath);
if (impacted.length > 0) {
const cwd = this.getWorkspaceFolder(uri.fsPath);

if (cwd) {
const impactedSources = impacted
.filter(obj => obj.relativePath)
.map(obj => path.join(cwd, obj.relativePath!));
if (cwd) {
const impactedSources = impacted
.filter(obj => obj.relativePath)
.map(obj => path.join(cwd, obj.relativePath!));

console.log(`Impacted sources: ${impactedSources.join(`, `)}`);
console.log(`Impacted sources: ${impactedSources.join(`, `)}`);

return Promise.allSettled(impactedSources.map(sourcePath => targets.parseFile(sourcePath)));
}
return Promise.allSettled(impactedSources.map(sourcePath => targets.parseFile(sourcePath)));
}
}
}
Expand Down
19 changes: 7 additions & 12 deletions vs/server/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { TargetsLanguageProvider } from '@ibm/sourceorbit';
import {
createConnection,
Diagnostic,
DiagnosticSeverity,
ProposedFeatures,
InitializeParams,
TextDocumentSyncKind,
InitializeResult,
WorkspaceFolder,
Range,
Position
ProposedFeatures,
TextDocumentSyncKind
} from 'vscode-languageserver/node';
import { SupportedGlob, TargetsManager } from './TargetsManager';
import { setupRequestHandler } from './requests';
import { setupFsListener } from './fileSystemListener';
import { setupRequestHandler } from './requests';

// Create a connection for the server, using Node's IPC as a transport.
// Also include all preview / proposed LSP features.
Expand All @@ -37,9 +32,9 @@ connection.onInitialize((params: InitializeParams) => {
if (hasWorkspaceFolderCapability) {
result.capabilities.workspace = {
fileOperations: {
didCreate: { filters: [{ pattern: { glob: SupportedGlob, options: { ignoreCase: true } } }] },
didRename: { filters: [{ pattern: { glob: SupportedGlob, options: { ignoreCase: true } } }] },
didDelete: { filters: [{ pattern: { glob: SupportedGlob, options: { ignoreCase: true } } }] }
didCreate: { filters: [{ pattern: { glob: TargetsLanguageProvider.getStandardGlob(), options: { ignoreCase: true } } }] },
didRename: { filters: [{ pattern: { glob: TargetsLanguageProvider.getStandardGlob(), options: { ignoreCase: true } } }] },
didDelete: { filters: [{ pattern: { glob: TargetsLanguageProvider.getStandardGlob(), options: { ignoreCase: true } } }] }
},
workspaceFolders: {
supported: true,
Expand Down
13 changes: 8 additions & 5 deletions vs/server/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import path from 'path';
import { URI } from 'vscode-uri';
import { ReadFileSystem } from './readFileSystem';
import { connection } from './server';
import { SupportedGlob, TargetsManager } from './TargetsManager';
import { TargetsManager } from './TargetsManager';

export async function initAndRefresh(workspaceUri: string) {
const progress = await connection.window.createWorkDoneProgress();
progress.begin(`Source Orbit`, undefined, `Initializing..`);
progress.begin(`Source Orbit`, undefined, `Indexing..`);
console.log(`Indexing started`);

try {
await TargetsManager.refreshProject(workspaceUri);
progress.report(`Initialized`);
progress.report(`Indexed successfully`);

} catch (e) {
progress.report(`Failed to initialize`);
Expand Down Expand Up @@ -89,13 +90,15 @@ export async function fixProject(workspaceUri: string, suggestions: TargetSugges
progress.begin(`Source Orbit`, undefined, `Fetching files..`);

const rfs = new ReadFileSystem();
const files = await rfs.getFiles(url, SupportedGlob);

const targets = new Targets(url, rfs);

const files = await rfs.getFiles(url, targets.getSearchGlob());

targets.setSuggestions(suggestions);

progress.report(`Loading files..`);
targets.loadObjectsFromPaths(files);
await targets.loadObjectsFromPaths(files);

progress.report(`Processing files..`);
await Promise.allSettled(files.map(f => targets.parseFile(f)));
Expand Down