22 | `
23 | document.body.appendChild(ch);
24 | };
25 |
26 | export default showConnectionCloseNotice;
27 |
--------------------------------------------------------------------------------
/client/ts/src/ui/configureCheckboxWithHiddenButton.ts:
--------------------------------------------------------------------------------
1 |
2 | const configureCheckboxWithHiddenButton = (
3 | checkbox: HTMLInputElement,
4 | button: HTMLButtonElement,
5 | onCheckboxChange: (checked: boolean) => void,
6 | displayEditor: (onClose: () => void) => ({ forceClose: () => void }),
7 | getButtonDecoration: () => string | null,
8 | ) => {
9 | checkbox.checked = getButtonDecoration() !== null;
10 | let overrideEditorCloser: (() => void) | null = null;
11 | const refreshButton = () => {
12 | const decoration = getButtonDecoration();
13 | if (decoration === null) {
14 | button.style.display = 'none';
15 | } else {
16 | button.style.display = 'inline-block';
17 | button.innerText = decoration;
18 | }
19 | };
20 | refreshButton();
21 |
22 | button.onclick = () => {
23 | button.disabled = true;
24 | const { forceClose } = displayEditor(() => {
25 | button.disabled = false;
26 | overrideEditorCloser = null;
27 | });
28 | overrideEditorCloser = () => forceClose();
29 | };
30 |
31 | checkbox.oninput = (e) => {
32 | overrideEditorCloser?.();
33 | onCheckboxChange(checkbox.checked);
34 | }
35 | return { refreshButton };
36 | }
37 |
38 | export default configureCheckboxWithHiddenButton;
39 |
--------------------------------------------------------------------------------
/client/ts/src/ui/configureCheckboxWithHiddenCheckbox.ts:
--------------------------------------------------------------------------------
1 |
2 | interface CheckboxConfig {
3 | checkbox: HTMLInputElement;
4 | initiallyChecked: boolean;
5 | onChange: (checked: boolean) => void;
6 | }
7 | const configureCheckboxWithHiddenCheckbox = (
8 | outer: CheckboxConfig,
9 | hidden: CheckboxConfig & { container: HTMLElement },
10 | ) => {
11 | outer.checkbox.checked = outer.initiallyChecked;
12 | hidden.checkbox.checked = hidden.initiallyChecked;
13 |
14 | const refreshHidden = () => {
15 | if (outer.checkbox.checked) {
16 | hidden.container.style.display = 'block';
17 | } else {
18 | hidden.container.style.display = 'none';
19 | }
20 | }
21 | refreshHidden();
22 |
23 | outer.checkbox.oninput = (e) => {
24 | refreshHidden();
25 | outer.onChange(outer.checkbox.checked);
26 | };
27 | hidden.checkbox.oninput = (e) => {
28 | hidden.onChange(hidden.checkbox.checked);
29 | };
30 | }
31 |
32 | export default configureCheckboxWithHiddenCheckbox;
33 |
--------------------------------------------------------------------------------
/client/ts/src/ui/create/attachDragToMove.ts:
--------------------------------------------------------------------------------
1 |
2 | import attachDragToX, { lastKnownMousePos } from "./attachDragToX"
3 |
4 | const attachDragToMove = (element: HTMLElement, initialPos?: ModalPosition | null, onFinishedMove?: () => void) => {
5 | const elemPos = { x: initialPos?.x ?? lastKnownMousePos.x, y: initialPos?.y ?? lastKnownMousePos.y };
6 | const startPos = {...elemPos};
7 | const onBegin = () => {
8 | startPos.x = elemPos.x;
9 | startPos.y = elemPos.y;
10 | };
11 | const onUpdate = (dx: number, dy: number) => {
12 | let newX = startPos.x + dx;
13 | let newY = startPos.y + dy;
14 | if (newY < 0) {
15 | newY = 0;
16 | } else {
17 | newY = Math.min(document.body.clientHeight - element.clientHeight, newY);
18 | }
19 | if (newX < 0) {
20 | newX = 0;
21 | } else {
22 | newX = Math.min(document.body.clientWidth - element.clientWidth, newX);
23 | }
24 | element.style.top = `${newY}px`;
25 | element.style.left = `${newX}px`;
26 | elemPos.x = newX;
27 | elemPos.y = newY;
28 | };
29 | onUpdate(0, 0);
30 | const { cleanup, hasMouseDown } = attachDragToX(element,
31 | onBegin,
32 | onUpdate,
33 | onFinishedMove
34 | );
35 | return {
36 | cleanup,
37 | getPos: () => elemPos,
38 | bumpIntoScreen: () => {
39 | if (!hasMouseDown()) {
40 | onBegin();
41 | onUpdate(0, 0);
42 | }
43 | },
44 | }
45 | }
46 |
47 | export default attachDragToMove;
48 |
--------------------------------------------------------------------------------
/client/ts/src/ui/create/createLoadingSpinner.ts:
--------------------------------------------------------------------------------
1 |
2 | const createLoadingSpinner = () => {
3 | const holder = document.createElement('div');
4 | holder.classList.add('lds-spinner');
5 | holder.innerHTML = ``;
6 | return holder;
7 | };
8 | export default createLoadingSpinner;
9 |
--------------------------------------------------------------------------------
/client/ts/src/ui/create/createSquigglyCheckbox.ts:
--------------------------------------------------------------------------------
1 |
2 | const createSquigglyCheckbox = (args: {
3 | onInput: (checked: boolean) => void;
4 | initiallyChecked: boolean;
5 | id?: string;
6 | }) => {
7 | const squigglyCheckboxWrapper = document.createElement('div');
8 | squigglyCheckboxWrapper.style.flexDirection = 'column';
9 |
10 | const squigglyCheckbox = document.createElement('input');
11 | squigglyCheckbox.type = 'checkbox';
12 | squigglyCheckbox.checked = args.initiallyChecked;
13 | if (args.id) squigglyCheckbox.id = args.id;
14 | squigglyCheckboxWrapper.appendChild(squigglyCheckbox);
15 | squigglyCheckbox.onmousedown = (e) => {
16 | e.preventDefault();
17 | e.stopPropagation();
18 | }
19 | squigglyCheckbox.oninput = (e) => {
20 | e.preventDefault();
21 | e.stopPropagation();
22 | args.onInput(squigglyCheckbox.checked);
23 | }
24 |
25 | // Based on https://stackoverflow.com/a/27764538
26 | const squigglyDemo = document.createElement('div');
27 | squigglyDemo.classList.add('squigglyLineHolder')
28 | const addTiny = (type: string) => {
29 | const tiny = document.createElement('div');
30 | tiny.classList.add('tinyLine');
31 | tiny.classList.add(type);
32 | squigglyDemo.appendChild(tiny);
33 | }
34 | addTiny('tinyLine1');
35 | addTiny('tinyLine2');
36 | squigglyCheckboxWrapper.appendChild(squigglyDemo);
37 | return squigglyCheckboxWrapper;
38 | }
39 |
--------------------------------------------------------------------------------
/client/ts/src/ui/create/registerNodeSelector.ts:
--------------------------------------------------------------------------------
1 | import { NodeLocator } from '../../protocol';
2 |
3 | const registerNodeSelector = (elem: HTMLElement, getLocator: () => NodeLocator) => {
4 | elem.classList.add('nodeLocatorContainer');
5 | elem.addEventListener('click', (e) => {
6 | if (!window.ActiveLocatorRequest) {
7 | return;
8 | }
9 | e.stopImmediatePropagation();
10 | e.stopPropagation();
11 | e.preventDefault();
12 | window.ActiveLocatorRequest.submit(getLocator());
13 | });
14 | };
15 |
16 | export default registerNodeSelector;
17 |
--------------------------------------------------------------------------------
/client/ts/src/ui/create/registerOnHover.ts:
--------------------------------------------------------------------------------
1 |
2 | const registerOnHover = (element: HTMLElement, onHover: (isHovering: boolean) => void) => {
3 | element.onmouseenter = () => onHover(true);
4 | element.onmouseleave = () => onHover(false);
5 | };
6 |
7 | export default registerOnHover;
8 |
--------------------------------------------------------------------------------
/client/ts/src/ui/getThemedColor.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 | type ColorType =
4 | 'window-border'
5 | | 'probe-result-area'
6 | | 'syntax-type'
7 | | 'syntax-attr'
8 | | 'syntax-modifier'
9 | | 'syntax-variable'
10 | | 'separator'
11 | | 'ast-node-bg'
12 | | 'ast-node-bg-hover';
13 |
14 | const lightColors: Record = {
15 | 'window-border': '#999',
16 | 'probe-result-area': '#F4F4F4',
17 | 'syntax-type': '#267F99',
18 | 'syntax-attr': '#795E26',
19 | 'syntax-modifier': '#0000FF',
20 | 'syntax-variable': '#001080',
21 | 'separator': '#000',
22 | 'ast-node-bg': '#DDD',
23 | 'ast-node-bg-hover': '#AAA',
24 | };
25 |
26 | const darkColors: typeof lightColors = {
27 | 'window-border': '#999',
28 | 'probe-result-area': '#333',
29 | 'syntax-type': '#4EC9B0',
30 | 'syntax-attr': '#DCDCAA',
31 | 'syntax-modifier': '#569CD6',
32 | 'syntax-variable': '#9CDCFE',
33 | 'separator': '#FFF',
34 | 'ast-node-bg': '#1C1C1C',
35 | 'ast-node-bg-hover': '#666',
36 | };
37 |
38 | const getThemedColor = (lightTheme: boolean, type: ColorType): string => {
39 | return (lightTheme ? lightColors : darkColors)[type];
40 | }
41 |
--------------------------------------------------------------------------------
/client/ts/src/ui/startEndToSpan.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 | const startEndToSpan = (start: number, end: number): Span => ({
4 | lineStart: (start >>> 12),
5 | colStart: start & 0xFFF,
6 | lineEnd: (end >>> 12),
7 | colEnd: end & 0xFFF,
8 | });
9 |
10 | export default startEndToSpan;
11 |
--------------------------------------------------------------------------------
/client/ts/src/ui/trimTypeName.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 | const trimTypeName = (typeName: string) => {
4 | const lastDot = typeName.lastIndexOf(".");
5 | return lastDot === -1 ? typeName : typeName.slice(lastDot + 1);
6 | }
7 |
8 | export default trimTypeName;
9 |
--------------------------------------------------------------------------------
/code-prober.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/code-prober.jar
--------------------------------------------------------------------------------
/gradle-plugin/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | build
3 | codeprobergradle*.jar
4 | publish-to-reposilite.sh
5 |
--------------------------------------------------------------------------------
/gradle-plugin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/gradle-plugin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle-plugin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradle-plugin/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'codeprobergradle'
2 |
--------------------------------------------------------------------------------
/gradle-plugin/src/main/java/org/codeprober/CodeProberPlugin.java:
--------------------------------------------------------------------------------
1 | package org.codeprober;
2 |
3 | import org.gradle.api.Plugin;
4 | import org.gradle.api.Project;
5 |
6 | public class CodeProberPlugin implements Plugin {
7 | @Override
8 | public void apply(Project project) {
9 | LaunchCodeProber task = project.getTasks().create("launchCodeProber", LaunchCodeProber.class);
10 | task.setGroup("CodeProber");
11 | task.setDescription("Start CodeProber and keep it running until Ctrl+C is pressed");
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/minimal-probe-wrapper/.gitignore:
--------------------------------------------------------------------------------
1 | build_tmp
2 | my-minimal-wrapper.jar
3 |
--------------------------------------------------------------------------------
/minimal-probe-wrapper/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | # Clean up from previous build
6 | rm -rf build_tmp
7 |
8 | # Build
9 | echo "Building sources"
10 | javac -d build_tmp src/mpw/*.java -source 8 -target 8
11 |
12 | # Make Jar
13 | echo "Generating jar.."
14 | cd build_tmp
15 | echo "Main-Class: mpw.MinimalProbeWrapper" >> Manifest.txt
16 | jar cfm ../my-minimal-wrapper.jar Manifest.txt **/*
17 |
18 | # Cleanup
19 | cd -
20 | rm -rf build_tmp
21 |
22 | echo "Done, build my-minimal-wrapper.jar"
23 | echo "Start with 'java -jar /path/to/codeprober.jar /path/to/my-minimial-wrapper.jar'"
24 |
--------------------------------------------------------------------------------
/minimal-probe-wrapper/src/mpw/MinimalProbeWrapper.java:
--------------------------------------------------------------------------------
1 | package mpw;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.nio.file.Files;
6 | import java.util.stream.Collectors;
7 |
8 | public class MinimalProbeWrapper {
9 |
10 | public static Object CodeProber_parse(String[] args) throws IOException {
11 | // The last arg is always a file with the contents inside the CodeProber window.
12 | // The non-last arg(s) are extra arguments, either set in the command-line when starting CodeProber,
13 | // or via "Override main args" in the CodeProber client.
14 | final File srcFile = new File(args[args.length - 1]);
15 |
16 | // Here we would typically parse 'src' into an AST and return it (optionally inside a wrapper).
17 | // However in this minimal implementation there is no parser, so we just keep 'src' as-is.
18 | final String src = Files.readAllLines(srcFile.toPath()).stream().collect(Collectors.joining("\n"));
19 | return new RootNode(src);
20 | }
21 |
22 | public static void main(String[] args) throws IOException {
23 | System.out.println("MinimalProbeWrapper started normally");
24 | System.out.println("Here you'd perform your normal application logic.");
25 | System.out.println("CodeProber uses 'CodeProber_parse' as an entry point.");
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/protocol/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/protocol/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/protocol/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Protocol
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
19 | 1731509980247
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/protocol/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.8
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
13 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
14 | org.eclipse.jdt.core.compiler.release=disabled
15 | org.eclipse.jdt.core.compiler.source=1.8
16 |
--------------------------------------------------------------------------------
/protocol/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | rm -rf build_tmp/
5 | mkdir build_tmp
6 |
7 | echo "Gathering sources.."
8 | find src -name "*.java" > sources.txt
9 |
10 | if [ ! -f "../codeprober.jar" ]; then
11 | echo "Missing codeprober.jar, it is needed to compile the protocol."
12 | echo "Please run the top build.sh script first, or download the latest release and place it in the root of this repo"
13 | exit 1
14 | fi
15 |
16 | echo "Building.."
17 | javac @sources.txt -cp ../codeprober.jar -d build_tmp -source 8 -target 8
18 |
19 | if [[ "$(uname -a)" =~ "CYGWIN"* ]]; then
20 | # Required for building on CYGWIN. Not sure if same is needed for WSL
21 | SEP=";"
22 | else
23 | SEP=":"
24 | fi
25 |
26 | java \
27 | -DJAVA_DST_DIR="../server/src/codeprober/protocol/data/" \
28 | -DJAVA_DST_PKG="codeprober.protocol.data" \
29 | -DTS_DST_FILE="../client/ts/src/protocol.ts" \
30 | -cp "build_tmp$(echo $SEP)../codeprober.jar" protocolgen.GenAll
31 |
32 | echo "Cleaning up.."
33 | rm sources.txt
34 | rm -rf build_tmp
35 |
36 | echo "Done"
37 |
--------------------------------------------------------------------------------
/protocol/code-prober.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/protocol/code-prober.jar
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/AsyncRpcUpdate.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class AsyncRpcUpdate extends Streamable {
4 | public final Object type = "asyncUpdate";
5 | public final Object job = Long.class;
6 | public final Object isFinalUpdate = Boolean.class;
7 | public final Object value = AsyncRpcUpdateValue.class;
8 | }
9 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/AsyncRpcUpdateValue.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class AsyncRpcUpdateValue extends StreamableUnion {
4 |
5 | public final Object status = String.class;
6 | public final Object workerStackTrace = arr(String.class);
7 | public final Object workerStatuses = arr(String.class);
8 | public final Object workerTaskDone = WorkerTaskDone.class;
9 | }
10 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/BackingFile.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class BackingFile extends Streamable {
4 | public final Object path = String.class;
5 | public final Object value = String.class;
6 | }
7 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/BackingFileUpdated.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class BackingFileUpdated extends Streamable {
4 | public final Object type = "backing_file_update";
5 | public final Object contents = String.class;
6 | }
7 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ChildStep.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class ChildStep extends Streamable {
4 | public final Object type = "child";
5 | public final Object value = Integer.class;
6 | }
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/Complete.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class Complete extends Rpc{
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "ide:complete";
10 | public final Object src = ParsingRequestData.class;
11 | public final Object line = Integer.class;
12 | public final Object column = Integer.class;
13 | };
14 | }
15 |
16 | @Override
17 | public Streamable getResponseType() {
18 | return new Streamable() {
19 | public final Object lines = opt(arr(String.class));
20 | };
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/Diagnostic.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import codeprober.protocol.DiagnosticType;
4 |
5 | public class Diagnostic extends Streamable {
6 | public final Object type = DiagnosticType.class;
7 | public final Object start = Integer.class;
8 | public final Object end = Integer.class;
9 | public final Object msg = String.class;
10 | }
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/FNStep.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class FNStep extends Streamable {
4 | public final Object property = Property.class;
5 | }
6 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/GetTestSuite.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import codeprober.protocol.GetTestSuiteContentsErrorCode;
4 |
5 | @SuppressWarnings("unused")
6 | public class GetTestSuite extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "Test:GetTestSuite";
12 | public final Object suite = String.class;
13 | };
14 | }
15 |
16 | @Override
17 | public Streamable getResponseType() {
18 | return new Streamable() {
19 | public final Object result = TestSuiteOrError.class;
20 | };
21 | }
22 |
23 | public static class TestSuiteOrError extends StreamableUnion {
24 | public final Object err = GetTestSuiteContentsErrorCode.class;
25 | public final Object contents = TestSuite.class;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/GetWorkerStatus.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class GetWorkerStatus extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "Concurrent:GetWorkerStatus";
10 | };
11 | }
12 |
13 | @Override
14 | public Streamable getResponseType() {
15 | return new Streamable() {
16 | public final Object stackTrace = arr(String.class);
17 | };
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/GetWorkspaceFile.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class GetWorkspaceFile extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "GetWorkspaceFile";
12 | public final Object path = String.class;
13 | };
14 | }
15 |
16 | @Override
17 | public Streamable getResponseType() {
18 | return new Streamable() {
19 | public final Object content = opt(String.class);
20 | public final Object metadata = opt(JSONObject.class);
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/HighlightableMessage.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class HighlightableMessage extends Streamable {
4 | public final Object start = Integer.class;
5 | public final Object end = Integer.class;
6 | public final Object msg = String.class;
7 | }
8 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/Hover.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class Hover extends Rpc{
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "ide:hover";
10 | public final Object src = ParsingRequestData.class;
11 | public final Object line = Integer.class;
12 | public final Object column = Integer.class;
13 | };
14 | }
15 |
16 | @Override
17 | public Streamable getResponseType() {
18 | return new Streamable() {
19 | public final Object lines = opt(arr(String.class));
20 | };
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/InitInfo.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class InitInfo extends Streamable{
5 |
6 | public final Object type = "init";
7 |
8 | public final Object version = new Streamable() {
9 | public final Object hash = String.class;
10 | public final Object clean = Boolean.class;
11 | public final Object buildTimeSeconds = opt(Integer.class);
12 | };
13 |
14 | public final Object changeBufferTime = opt(Integer.class);
15 | public final Object workerProcessCount = opt(Integer.class);
16 | public final Object disableVersionCheckerByDefault = opt(Boolean.class);
17 | public final Object backingFile = opt(BackingFile.class);
18 | }
19 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ListNodes.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class ListNodes extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "ListNodes";
10 | public final Object pos = Integer.class;
11 | public final Object src = ParsingRequestData.class;
12 | };
13 | }
14 |
15 | @Override
16 | public Streamable getResponseType() {
17 | return new Streamable() {
18 | public final Object body = arr(RpcBodyLine.class);
19 | public final Object nodes = opt(arr(NodeLocator.class));
20 | public final Object errors = opt(arr(Diagnostic.class));
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ListProperties.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class ListProperties extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "ListProperties";
10 | public final Object all = Boolean.class;
11 | public final Object locator = NodeLocator.class;
12 | public final Object src = ParsingRequestData.class;
13 | };
14 | }
15 |
16 | @Override
17 | public Streamable getResponseType() {
18 | return new Streamable() {
19 | public final Object body = arr(RpcBodyLine.class);
20 | public final Object properties = opt(arr(Property.class));
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ListTestSuites.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import codeprober.protocol.ListTestSuitesErrorCode;
4 |
5 | @SuppressWarnings("unused")
6 | public class ListTestSuites extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "Test:ListTestSuites";
12 | };
13 | }
14 |
15 | @Override
16 | public Streamable getResponseType() {
17 | return new Streamable() {
18 | public final Object result = TestSuiteListOrError.class;
19 | };
20 | }
21 |
22 | public static class TestSuiteListOrError extends StreamableUnion {
23 | public final Object err = ListTestSuitesErrorCode.class;
24 | public final Object suites = arr(String.class);
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ListTree.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class ListTree extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = oneOf("ListTreeUpwards", "ListTreeDownwards");
10 | public final Object locator = NodeLocator.class;
11 | public final Object src = ParsingRequestData.class;
12 | };
13 | }
14 |
15 | @Override
16 | public Streamable getResponseType() {
17 | return new Streamable() {
18 | public final Object body = arr(RpcBodyLine.class);
19 | public final Object locator = opt(NodeLocator.class);
20 | public final Object node = opt(ListedTreeNode.class);
21 | };
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ListWorkspaceDirectory.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class ListWorkspaceDirectory extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "ListWorkspaceDirectory";
10 | public final Object path = opt(String.class);
11 | };
12 | }
13 |
14 | @Override
15 | public Streamable getResponseType() {
16 | return new Streamable() {
17 | public final Object entries = opt(arr(WorkspaceEntry.class));
18 | };
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ListedTreeChildNode.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class ListedTreeChildNode extends StreamableUnion {
4 | public final Object children = arr(ListedTreeNode.class);
5 | public final Object placeholder = Integer.class;
6 | }
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ListedTreeNode.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class ListedTreeNode extends Streamable {
4 | public final Object type = "node";
5 | public final Object locator = NodeLocator.class;
6 | public final Object name = opt(String.class);
7 | public final Object children = ListedTreeChildNode.class;
8 | }
9 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/LongPollResponse.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | public class LongPollResponse extends StreamableUnion {
6 |
7 | public final Object etag = Integer.class;
8 | public final Object push = JSONObject.class;
9 | }
10 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/NestedTest.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class NestedTest extends Streamable {
4 | // Index chain in parent's output.
5 | public final Object path = arr(Integer.class);
6 | public final Object property = Property.class;
7 | public final Object expectedOutput = arr(RpcBodyLine.class);
8 | public final Object nestedProperties = arr(NestedTest.class);
9 | }
10 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/NodeLocator.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import java.util.Arrays;
4 |
5 | public class NodeLocator extends Streamable {
6 | public final Object result = TALStep.class;
7 | public final Object steps = Arrays.asList(NodeLocatorStep.class);
8 | }
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/NodeLocatorStep.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class NodeLocatorStep extends StreamableUnion {
4 | public final Object child = Integer.class;
5 | public final Object nta = FNStep.class;
6 | public final Object tal = TALStep.class;
7 | }
8 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/NullableNodeLocator.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class NullableNodeLocator extends Streamable {
4 | public final Object type = String.class;
5 | public final Object value = opt(NodeLocator.class);
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ParsingRequestData.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import java.util.Arrays;
4 | import java.util.Optional;
5 |
6 | import codeprober.protocol.AstCacheStrategy;
7 | import codeprober.protocol.PositionRecoveryStrategy;
8 |
9 | public class ParsingRequestData extends Streamable {
10 | public final Object posRecovery = PositionRecoveryStrategy.class;
11 | public final Object cache = AstCacheStrategy.class;
12 | public final Object src = ParsingSource.class;
13 | public final Object mainArgs = Optional.of(Arrays.asList(String.class));
14 | public final Object tmpSuffix = String.class;
15 | }
16 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/ParsingSource.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class ParsingSource extends StreamableUnion {
4 | public final Object text = String.class;
5 | public final Object workspacePath = String.class;
6 | }
7 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/PollWorkerStatus.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class PollWorkerStatus extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "Concurrent:PollWorkerStatus";
10 | public final Object job = Long.class;
11 | };
12 | }
13 |
14 | @Override
15 | public Streamable getResponseType() {
16 | return new Streamable() {
17 | public final Object ok = Boolean.class;
18 | };
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/Property.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class Property extends Streamable {
4 | public final Object name = String.class;
5 | public final Object args = opt(arr(PropertyArg.class));
6 | public final Object astChildName = opt(String.class);
7 | public final Object aspect = opt(String.class);
8 | }
9 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/PropertyArg.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class PropertyArg extends StreamableUnion{
4 | public final Object string = String.class;
5 | public final Object integer = Integer.class;
6 | public final Object bool = Boolean.class;
7 | public final Object collection = PropertyArgCollection.class;
8 | public final Object outputstream = String.class;
9 | public final Object nodeLocator = NullableNodeLocator.class;
10 | }
11 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/PropertyArgCollection.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class PropertyArgCollection extends Streamable {
4 | public final Object type = String.class;
5 | public final Object entries = arr(PropertyArg.class);
6 | }
7 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/PutTestSuite.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import codeprober.protocol.PutTestSuiteContentsErrorCode;
4 |
5 | @SuppressWarnings("unused")
6 | public class PutTestSuite extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "Test:PutTestSuite";
12 | public final Object suite = String.class;
13 | public final Object contents = TestSuite.class;
14 | };
15 | }
16 |
17 | @Override
18 | public Streamable getResponseType() {
19 | return new Streamable() {
20 | public final Object err = opt(PutTestSuiteContentsErrorCode.class);
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/PutWorkspaceContent.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class PutWorkspaceContent extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "PutWorkspaceContent";
12 | public final Object path = String.class;
13 | public final Object content = String.class;
14 | };
15 | }
16 |
17 | @Override
18 | public Streamable getResponseType() {
19 | return new Streamable() {
20 | public final Object ok = Boolean.class;
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/PutWorkspaceMetadata.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class PutWorkspaceMetadata extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "PutWorkspaceMetadata";
12 | public final Object path = String.class;
13 | public final Object metadata = opt(JSONObject.class);
14 | };
15 | }
16 |
17 | @Override
18 | public Streamable getResponseType() {
19 | return new Streamable() {
20 | public final Object ok = Boolean.class;
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/Refresh.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class Refresh extends Streamable {
4 | public final Object type = "refresh";
5 | }
6 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/RenameWorkspacePath.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class RenameWorkspacePath extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "RenameWorkspacePath";
12 | public final Object srcPath = String.class;
13 | public final Object dstPath = String.class;
14 | };
15 | }
16 |
17 | @Override
18 | public Streamable getResponseType() {
19 | return new Streamable() {
20 | public final Object ok = Boolean.class;
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/Rpc.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public abstract class Rpc {
4 | public abstract Streamable getRequestType();
5 | public abstract Streamable getResponseType();
6 | }
7 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/RpcBodyLine.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class RpcBodyLine extends StreamableUnion {
4 | public final Object plain = String.class;
5 | public final Object stdout = String.class;
6 | public final Object stderr = String.class;
7 | public final Object streamArg = String.class;
8 | public final Object arr = arr(RpcBodyLine.class);
9 | public final Object node = NodeLocator.class;
10 | public final Object dotGraph = String.class;
11 | public final Object highlightMsg = HighlightableMessage.class;
12 | public final Object tracing = Tracing.class;
13 | public final Object html = String.class;
14 | }
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/StopJob.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class StopJob extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "Concurrent:StopJob";
10 | public final Object job = Integer.class;
11 | };
12 | }
13 |
14 | @Override
15 | public Streamable getResponseType() {
16 | return new Streamable() {
17 | public final Object err = opt(String.class);
18 | };
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/Streamable.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import java.util.Arrays;
4 | import java.util.Optional;
5 |
6 | public class Streamable {
7 |
8 | protected static Object opt(Object val) { return Optional.of(val); }
9 | protected static Object arr(Object val) { return Arrays.asList(val); }
10 | protected static Object oneOf(String... vals) { return vals; }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/StreamableUnion.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class StreamableUnion extends Streamable {
4 | }
5 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/SubmitWorkerTask.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class SubmitWorkerTask extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "Concurrent:SubmitTask";
12 | public final Object job = Long.class;
13 | public final Object data = JSONObject.class;
14 | };
15 | }
16 |
17 | @Override
18 | public Streamable getResponseType() {
19 | return new Streamable() {
20 | public final Object ok = Boolean.class;
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/SubscribeToWorkerStatus.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class SubscribeToWorkerStatus extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "Concurrent:SubscribeToWorkerStatus";
10 | public final Object job = Integer.class;
11 | };
12 | }
13 |
14 | @Override
15 | public Streamable getResponseType() {
16 | return new Streamable() {
17 | public final Object subscriberId = Integer.class;
18 | };
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/TALStep.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class TALStep extends Streamable{
4 | public final Object type = String.class;
5 | public final Object label = opt(String.class);
6 | public final Object start = Integer.class;
7 | public final Object end = Integer.class;
8 | public final Object depth = Integer.class;
9 | public final Object external = opt(Boolean.class);
10 | }
11 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/TestCase.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import codeprober.protocol.TestCaseAssertType;
4 |
5 | public class TestCase extends Streamable {
6 | public final Object name = String.class;
7 | public final Object src = ParsingRequestData.class;
8 | public final Object property = Property.class;
9 | public final Object locator = NodeLocator.class;
10 | public final Object assertType = TestCaseAssertType.class;
11 | public final Object expectedOutput = arr(RpcBodyLine.class);
12 | public final Object nestedProperties = arr(NestedTest.class);
13 | }
14 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/TestCaseAssert.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class TestCaseAssert extends StreamableUnion {
4 | public final Object identity = arr(RpcBodyLine.class);
5 | public final Object set = arr(RpcBodyLine.class);
6 | public final Object smoke = Boolean.class;
7 | }
8 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/TestSuite.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class TestSuite extends Streamable {
4 | // Version flag, used for upggrading files in the future
5 | public final Object v = Integer.class;
6 | public final Object cases = arr(TestCase.class);
7 | }
8 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/TopRequest.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class TopRequest extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "rpc";
12 | public final Object id = Long.class;
13 | public final Object data = JSONObject.class;
14 | };
15 | }
16 |
17 | @Override
18 | public Streamable getResponseType() {
19 | return new Streamable() {
20 | public final Object type = "rpc";
21 | public final Object id = Long.class;
22 | public final Object data = TopRequestResponseData.class;
23 | };
24 | }
25 |
26 | public static class TopRequestResponseData extends StreamableUnion {
27 | public final Object success = JSONObject.class;
28 | public final Object failureMsg = String.class;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/Tracing.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class Tracing extends Streamable {
4 |
5 | public final Object node = NodeLocator.class;
6 | public final Object prop = Property.class;
7 | public final Object dependencies = arr(Tracing.class);
8 | public final Object result = RpcBodyLine.class;
9 | }
10 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/TunneledWsPutRequest.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class TunneledWsPutRequest extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "wsput:tunnel";
12 | public final Object session = String.class;
13 | public final Object request = JSONObject.class;
14 | };
15 | }
16 |
17 | @Override
18 | public Streamable getResponseType() {
19 | return new Streamable() {
20 | public final Object response = JSONObject.class;
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/UnlinkWorkspacePath.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class UnlinkWorkspacePath extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "UnlinkWorkspacePath";
12 | public final Object path = String.class;
13 | };
14 | }
15 |
16 | @Override
17 | public Streamable getResponseType() {
18 | return new Streamable() {
19 | public final Object ok = Boolean.class;
20 | };
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/UnsubscribeFromWorkerStatus.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class UnsubscribeFromWorkerStatus extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "Concurrent:UnsubscribeFromWorkerStatus";
10 | public final Object job = Integer.class;
11 | public final Object subscriberId = Integer.class;
12 | };
13 | }
14 |
15 | @Override
16 | public Streamable getResponseType() {
17 | return new Streamable() {
18 | public final Object ok = Boolean.class;
19 | };
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/WorkerTaskDone.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | public class WorkerTaskDone extends StreamableUnion {
6 |
7 | public final Object normal = JSONObject.class;
8 | public final Object unexpectedError = arr(String.class);
9 | }
10 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/WorkspaceEntry.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class WorkspaceEntry extends StreamableUnion {
4 | public final Object file = String.class;
5 | public final Object directory = String.class;
6 | }
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/WorkspacePathsUpdated.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | public class WorkspacePathsUpdated extends Streamable {
4 | public final Object type = "workspace_paths_updated";
5 | public final Object paths = arr(String.class);
6 | }
7 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/WsPutInit.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | @SuppressWarnings("unused")
4 | public class WsPutInit extends Rpc {
5 |
6 | @Override
7 | public Streamable getRequestType() {
8 | return new Streamable() {
9 | public final Object type = "wsput:init";
10 | public final Object session = String.class;
11 | };
12 | }
13 |
14 | @Override
15 | public Streamable getResponseType() {
16 | return new Streamable() {
17 | public final Object info = InitInfo.class;
18 | };
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/protocol/src/protocolgen/spec/WsPutLongpoll.java:
--------------------------------------------------------------------------------
1 | package protocolgen.spec;
2 |
3 | import org.json.JSONObject;
4 |
5 | @SuppressWarnings("unused")
6 | public class WsPutLongpoll extends Rpc {
7 |
8 | @Override
9 | public Streamable getRequestType() {
10 | return new Streamable() {
11 | public final Object type = "wsput:longpoll";
12 | public final Object session = String.class;
13 | public final Object etag = Integer.class;
14 | };
15 | }
16 |
17 | @Override
18 | public Streamable getResponseType() {
19 | return new Streamable() {
20 | public final Object data = opt(LongPollResponse.class);
21 | };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/run-benchmark.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/run-benchmark.jar
--------------------------------------------------------------------------------
/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/server/.DS_Store
--------------------------------------------------------------------------------
/server/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/server/.gitignore:
--------------------------------------------------------------------------------
1 | build_tmp
2 | sources.txt
3 |
--------------------------------------------------------------------------------
/server/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Pasta
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
19 | 1731509980246
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/server/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=1.8
13 |
--------------------------------------------------------------------------------
/server/libs/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/server/libs/.DS_Store
--------------------------------------------------------------------------------
/server/libs/hamcrest-2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/server/libs/hamcrest-2.2.jar
--------------------------------------------------------------------------------
/server/libs/json.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/server/libs/json.jar
--------------------------------------------------------------------------------
/server/libs/junit-4.13.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lu-cs-sde/codeprober/88a1a2ef91992ddd6b37efd8c5126f5c72b0e0db/server/libs/junit-4.13.2.jar
--------------------------------------------------------------------------------
/server/src-test/codeprober/RunAddNumTests.java:
--------------------------------------------------------------------------------
1 | package codeprober;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 |
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.junit.runners.Parameterized;
9 | import org.junit.runners.Parameterized.Parameters;
10 |
11 | import codeprober.test.WorkspaceTestCase;
12 | import codeprober.toolglue.UnderlyingTool;
13 |
14 | @RunWith(Parameterized.class)
15 | public class RunAddNumTests {
16 |
17 | @Parameters(name = "{0}")
18 | public static Iterable data() throws IOException {
19 | return WorkspaceTestCase.listTextProbesInWorkspace( //
20 | UnderlyingTool.fromJar("../addnum/AddNum.jar"), //
21 | new File("../addnum/workspace"));
22 | }
23 |
24 | private final WorkspaceTestCase tc;
25 |
26 | public RunAddNumTests(WorkspaceTestCase tc) {
27 | this.tc = tc;
28 | }
29 |
30 | @Test
31 | public void run() {
32 | if (tc.getSrcFilePath().contains("err_")) {
33 | tc.assertFail();
34 | } else {
35 | tc.assertPass();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/server/src-test/codeprober/ast/ASTNodeAnnotation.java:
--------------------------------------------------------------------------------
1 | package codeprober.ast;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 |
7 | interface ASTNodeAnnotation {
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @interface Attribute {
10 | boolean isNTA() default true;
11 | }
12 | }
--------------------------------------------------------------------------------
/server/src/codeprober/ast/AstLoopException.java:
--------------------------------------------------------------------------------
1 | package codeprober.ast;
2 |
3 | /**
4 | * There are cases where an AST node can have itself as an (indirect) parent.
5 | * This indicates a bug in the AST construction or how attributes are
6 | * written.
7 | */
8 | @SuppressWarnings("serial")
9 | public class AstLoopException extends RuntimeException {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/server/src/codeprober/ast/AstParentException.java:
--------------------------------------------------------------------------------
1 | package codeprober.ast;
2 |
3 | @SuppressWarnings("serial")
4 | public class AstParentException extends RuntimeException {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/server/src/codeprober/locator/NodeEdge.java:
--------------------------------------------------------------------------------
1 | package codeprober.locator;
2 |
3 | import org.json.JSONObject;
4 |
5 | import codeprober.ast.AstNode;
6 |
7 | /**
8 | * Represents a step from a parent to a child node.
9 | */
10 | //abstract class NodeEdge {
11 | //
12 | // public static enum NodeEdgeType {
13 | // ChildIndex("child"), FN("nta"), TypeAtLoc("tal");
14 | //
15 | // private String jsonRepresentation;
16 | //
17 | // private NodeEdgeType(String jsonRepresentation) {
18 | // this.jsonRepresentation = jsonRepresentation;
19 | //
20 | // }
21 | // }
22 | //
23 | // public final AstNode sourceNode;
24 | // public final TypeAtLoc sourceLoc;
25 | //
26 | // public final AstNode targetNode;
27 | // public final TypeAtLoc targetLoc;
28 | // public final NodeEdgeType type;
29 | // public final Object value;
30 | //
31 | // public NodeEdge(AstNode sourceNode, TypeAtLoc sourceLoc, AstNode targetNode, TypeAtLoc targetLoc, NodeEdgeType type,
32 | // Object value) {
33 | // this.sourceNode = sourceNode;
34 | // this.sourceLoc = sourceLoc;
35 | // this.targetNode = targetNode;
36 | // this.targetLoc = targetLoc;
37 | // this.type = type;
38 | // this.value = value;
39 | // }
40 | //
41 | // public boolean canBeCollapsed() {
42 | // return targetLoc.loc.isMeaningful() && type == NodeEdgeType.TypeAtLoc;
43 | // }
44 | //
45 | // public JSONObject toJson() {
46 | // final JSONObject obj = new JSONObject();
47 | // obj.put("type", type.jsonRepresentation);
48 | // obj.put("value", value);
49 | // return obj;
50 | // }
51 | //
52 | // @Override
53 | // public String toString() {
54 | // return type + "<" + targetNode + ">";
55 | // }
56 | //}
57 |
--------------------------------------------------------------------------------
/server/src/codeprober/locator/Span.java:
--------------------------------------------------------------------------------
1 | package codeprober.locator;
2 |
3 | import java.util.Objects;
4 |
5 | public class Span {
6 | public final int start, end;
7 |
8 | public Span(int start, int end) {
9 | this.start = start;
10 | this.end = end;
11 | }
12 |
13 | public int getStartLine() {
14 | return start >>> 12;
15 | }
16 |
17 | public int getStartColumn() {
18 | return start & 0xFFF;
19 | }
20 |
21 | public int getEndLine() {
22 | return end >>> 12;
23 | }
24 |
25 | public int getEndColumn() {
26 | return end & 0xFFF;
27 | }
28 |
29 | public boolean isMeaningful() {
30 | return start != 0 || end != 0;
31 | }
32 |
33 | @Override
34 | public int hashCode() {
35 | return Objects.hash(end, start);
36 | }
37 |
38 | @Override
39 | public String toString() {
40 | return "[" + start + "," + end + "]";
41 | }
42 |
43 | @Override
44 | public boolean equals(Object obj) {
45 | if (this == obj)
46 | return true;
47 | if (obj == null)
48 | return false;
49 | if (getClass() != obj.getClass())
50 | return false;
51 | Span other = (Span) obj;
52 | return end == other.end && start == other.start;
53 | }
54 |
55 | public boolean overlaps(Span other) {
56 | if (end < other.start || start > other.end) {
57 | return false;
58 | }
59 | return true;
60 | }
61 |
62 | public boolean covers(int startPos, int endPos) {
63 | return !isMeaningful() || (this.start <= startPos && this.end >= endPos);
64 | }
65 |
66 | public boolean containsLine(int line) {
67 | return !isMeaningful() || (getStartLine() <= line && getEndLine() >= line);
68 | }
69 | }
--------------------------------------------------------------------------------
/server/src/codeprober/locator/TypeAtLoc.java:
--------------------------------------------------------------------------------
1 | package codeprober.locator;
2 |
3 | import java.util.Objects;
4 |
5 | import codeprober.AstInfo;
6 | import codeprober.ast.AstNode;
7 | import codeprober.metaprogramming.InvokeProblem;
8 |
9 | public class TypeAtLoc {
10 |
11 | public final String type;
12 | public final Span loc;
13 | public final String label;
14 |
15 | public TypeAtLoc(String type, Span position, String label) {
16 | this.type = type;
17 | this.loc = position;
18 | this.label = label;
19 | }
20 |
21 | @Override
22 | public String toString() {
23 | String labelInsert;
24 | if (label != null) {
25 | labelInsert = "[" + label + "]";
26 | } else {
27 | labelInsert = "";
28 | }
29 | return type + labelInsert + "@[" + loc.start + ".." + loc.end + "]";
30 | }
31 |
32 | public static TypeAtLoc from(AstInfo info, AstNode astNode) throws InvokeProblem {
33 | return new TypeAtLoc(astNode.underlyingAstNode.getClass().getName(), astNode.getRecoveredSpan(info), astNode.getNodeLabel());
34 | }
35 |
36 | @Override
37 | public int hashCode() {
38 | return Objects.hash(loc, type);
39 | }
40 |
41 | @Override
42 | public boolean equals(Object obj) {
43 | if (this == obj)
44 | return true;
45 | if (obj == null)
46 | return false;
47 | if (getClass() != obj.getClass())
48 | return false;
49 | final TypeAtLoc other = (TypeAtLoc) obj;
50 | return Objects.equals(loc, other.loc) && Objects.equals(type, other.type) && Objects.equals(label, other.label);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/server/src/codeprober/metaprogramming/AstNodeApiStyle.java:
--------------------------------------------------------------------------------
1 | package codeprober.metaprogramming;
2 |
3 | public enum AstNodeApiStyle {
4 |
5 | /**
6 | * cpr_getStartLine(), cpr_getStartColumn(), cpr_getEndLine(),
7 | * cpr_getEndColumn(), getNumChild(), getChild(int), getParent()
8 | *
9 | * This is same as {@link #JASTADD_SEPARATE_LINE_COLUMN} but with a cpr_ prefix
10 | * for position info. This is to help tools that are using position for
11 | * something else, and that don't necessarily use the same conventions as
12 | * CodeProber. For example, CodeProber expects the first column to be 1, and a
13 | * missing position to be zero. Other tools might already be implemented with a
14 | * different standard, and can then use the cpr_ prefix to support both
15 | * conventions simultaneously.
16 | */
17 |
18 | CPR_SEPARATE_LINE_COLUMN,
19 |
20 | /**
21 | * getStart() and getEnd(), each with 20 bits for line and 12 bits for column,
22 | * e.g: 0xLLLLLCCC.
23 | *
24 | * getNumChild(), getChild(int), getParent()
25 | */
26 | BEAVER_PACKED_BITS,
27 |
28 | /**
29 | * getStartLine(), getStartColumn(), getEndLine(), getEndColumn(),
30 | * getNumChild(), getChild(int), getParent()
31 | */
32 | JASTADD_SEPARATE_LINE_COLUMN,
33 |
34 | /**
35 | * The style used by PMD. getBeginLine(), getBeginColumn(), getEndLine(),
36 | * getEndColumn() getNumChildren(), getChild(int), getParent()
37 | */
38 | PMD_SEPARATE_LINE_COLUMN,
39 |
40 | /**
41 | * No line/column functions.
42 | * getNumChild(), getChild(int), getParent()
43 | */
44 | JASTADD_NO_POSITION,
45 | }
46 |
--------------------------------------------------------------------------------
/server/src/codeprober/metaprogramming/InvokeProblem.java:
--------------------------------------------------------------------------------
1 | package codeprober.metaprogramming;
2 |
3 | @SuppressWarnings("serial")
4 | public class InvokeProblem extends RuntimeException {
5 |
6 | public InvokeProblem(Throwable cause) {
7 | super(cause);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/server/src/codeprober/metaprogramming/Reflect.java:
--------------------------------------------------------------------------------
1 | package codeprober.metaprogramming;
2 |
3 | import java.lang.reflect.InvocationTargetException;
4 | import java.lang.reflect.Method;
5 |
6 | public class Reflect {
7 |
8 | public static final Object VOID_RETURN_VALUE = new Object() {
9 | @Override
10 | public String toString() {
11 | return "";
12 | }
13 | };
14 |
15 | public static Object getParent(Object astNode) {
16 | return Reflect.invoke0(astNode, "getParent");
17 | }
18 |
19 | public static Object invokeN(Object astNode, String mth, Class>[] argTypes, Object[] argValues) {
20 | try {
21 | final Method m = astNode.getClass().getMethod(mth, argTypes);
22 | m.setAccessible(true);
23 | final Object val = m.invoke(astNode, argValues);
24 | return m.getReturnType() == Void.TYPE ? VOID_RETURN_VALUE : val;
25 | } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
26 | | SecurityException e) {
27 | throw new InvokeProblem(e);
28 | }
29 | }
30 |
31 | public static Object invoke0(Object astNode, String mth) {
32 | try {
33 | final Method m = astNode.getClass().getMethod(mth);
34 | m.setAccessible(true);
35 | final Object val = m.invoke(astNode);
36 | return m.getReturnType() == Void.TYPE ? VOID_RETURN_VALUE : val;
37 | } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
38 | | SecurityException e) {
39 | throw new InvokeProblem(e);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/server/src/codeprober/metaprogramming/TypeIdentifier.java:
--------------------------------------------------------------------------------
1 | package codeprober.metaprogramming;
2 |
3 | import codeprober.ast.AstNode;
4 |
5 | public interface TypeIdentifier {
6 | boolean matchesDesiredType(AstNode node);
7 | }
8 |
--------------------------------------------------------------------------------
/server/src/codeprober/protocol/AstCacheStrategy.java:
--------------------------------------------------------------------------------
1 | package codeprober.protocol;
2 |
3 | /**
4 | * Caching the AST is great for performance, but can hurt the debugging process
5 | * sometimes. This enum represents the choices the user can make for caching.
6 | */
7 | public enum AstCacheStrategy {
8 |
9 | /**
10 | * Cache everything when possible.
11 | */
12 | FULL,
13 |
14 | /**
15 | * Keep the AST if the input file is identical, but call 'flushTreeCache' before
16 | * evaluating any attribute.
17 | *