Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
d84e95a
Enable OcaIDE debugging with variables relating to Camlp4 module.
May 15, 2012
79e71ff
set high priority for parsing file in order to find function name
May 16, 2012
db093e6
Merge remote branch 'upstream/master'
Oct 29, 2012
ab47ad2
merge with upstream
Oct 29, 2012
a33a704
fix exception StackOverFlow in pattern maching
Oct 30, 2012
e13c1be
StackOverFlow exception when parsing annot file that has class defini…
Oct 31, 2012
00147ee
Merge remote branch 'upstream/master'
Nov 6, 2012
d2d586f
Allow converting spaces <--> tabs in a selected text
Nov 6, 2012
b6a6336
check for a valid selection in converting spaces <--> tabs
Nov 6, 2012
3c61404
update from upstream/master
Nov 7, 2012
421e968
no appending newline character to the last line of template
Nov 7, 2012
cbc430b
Provide the subdirectory paths of '_build' folder to OcamlDebugger wh…
Dec 7, 2012
0087a65
jump to the exact source code location from call stack frame, high li…
Dec 12, 2012
a689bab
add build folder
Jun 4, 2013
685eb6a
Enable OcaIDE debugging with variables relating to Camlp4 module.
May 15, 2012
b02395c
merge with upstream
Oct 29, 2012
a7517c6
support multiple-lines-comment style like Eclipse for Java
May 3, 2014
b101446
merge changes from HEAD
May 3, 2014
5f08dfd
enhance comment at the end of file
May 7, 2014
37ee9ef
more enhancements for comment feature
May 7, 2014
7b6cfb9
Merge remote-tracking branch 'upstream/master'
Oct 4, 2014
c942272
improve code completion feature
Oct 4, 2014
4312d22
improvement on code completion feature
Oct 4, 2014
061161d
improvement on 'jump to definition'
Oct 6, 2014
bda3ba8
minor changes
Oct 6, 2014
5cfa162
minor changes
Oct 6, 2014
8e643a8
m
Oct 6, 2014
da13750
restructure
Oct 6, 2014
4f51d43
restructure code
Oct 6, 2014
5d1579b
add 'go to definition' feature
Oct 6, 2014
b0d6142
some changes
Oct 6, 2014
3a049f7
chaneg priority of parsing mli files to the highest
Oct 6, 2014
2bf27af
improvements
Oct 7, 2014
adccf9b
quick jump to next, prev block of code
Oct 7, 2014
20dcf50
at least can make auto-completion works
Oct 7, 2014
d531659
minor changes
Oct 7, 2014
b3bf14e
significant changes, and I'm happy with them
Oct 8, 2014
999e831
improve on selection feature
Oct 8, 2014
ba0e202
improvements
Oct 8, 2014
5d0eaa9
improvements
Oct 8, 2014
a357dea
improve hover feature
Oct 9, 2014
d4bffb1
improvements
Oct 9, 2014
0357810
always show type even souce code is modified
Oct 9, 2014
c7cf826
minor changes
Oct 9, 2014
d55f9d6
still need to be improved
Oct 9, 2014
f062019
in progress
Oct 9, 2014
7d62805
so far so good
Oct 9, 2014
b63b4d0
significant improvements
Oct 9, 2014
fba111c
acceptable, (so sleepy)
Oct 9, 2014
c6a5da2
wonderful, go home and sleep now!
Oct 9, 2014
6b509d1
cache last parsed annotation
Oct 10, 2014
9bdd7dc
Go to next/previous annotation
Oct 10, 2014
9503b7b
improvement on annotation navigating
Oct 10, 2014
1a0a1db
improve build actions
Oct 10, 2014
b7193ad
minor changes
Oct 10, 2014
6ddf102
minor changes
Oct 10, 2014
6bca819
minor changes
Oct 11, 2014
4edd405
improvement on completion
Oct 11, 2014
9ff5582
improvement on completion
Oct 11, 2014
582fade
Merge branch 'master' into HEAD
Oct 11, 2014
4c56def
more improvements
Oct 11, 2014
dc76b8c
minor changes
Oct 11, 2014
680fbd7
minor changes
Oct 12, 2014
41fb49d
minor changes
Oct 12, 2014
6369ad1
print compiling time
Oct 12, 2014
8c63845
some changes
Oct 12, 2014
7c8f353
improve going to definition
Oct 12, 2014
b5b5142
some changes
Oct 13, 2014
bf400a4
minor changes
Oct 13, 2014
a713da4
Add recovery ability to parser
Oct 13, 2014
78882c1
minor changes
Oct 13, 2014
6e637af
fix bug: new navigation shortcuts doesn't work after starting to compile
Oct 13, 2014
2fd3da0
add type information in auto-completion
Oct 14, 2014
099f1ca
allow search type information in outline
Oct 14, 2014
dd1bb50
hyperlink detector and go to defintion is more precise
Oct 14, 2014
ce9ed6c
testing scripts
Oct 14, 2014
8497447
improve outline feature
Oct 14, 2014
a6a5694
don't show identifer, paramter in quick outline
Oct 14, 2014
4c82344
support regex in quick outline
Oct 14, 2014
a260e5d
add foreground color to preference
Oct 16, 2014
440540c
remove foreground setting from preferences
Oct 17, 2014
ccb12ed
update correct path of projects. Always add current dir '.' to projec…
Oct 20, 2014
fc2422d
allow Parameter typ in Def structure
Oct 20, 2014
1de9d57
jump by indentation
Oct 20, 2014
4fe484f
selection by indentation
Oct 20, 2014
a8a4e6e
move cursor and select text by blocks
Oct 20, 2014
16c2877
precisify Def data structure by adding more information
Oct 21, 2014
0c321ec
delete trailing whitespaces
Oct 21, 2014
541023f
improve on auto-completion
Oct 21, 2014
871d24a
add all identifiers to Def tree when parsing error
Oct 21, 2014
7e9e9e2
show type of functions in built-in library and external functions
Oct 21, 2014
8bb60bd
suggest proposals which are longer than completion text
Oct 22, 2014
12b84dd
unnest type constructors
Oct 22, 2014
d685411
recover more information of Def tree when parsing error
Oct 22, 2014
6a7d023
reset .paths file when create a new project
Oct 22, 2014
b406ff6
do not rebuild outline when text is changed because it slows down the…
Oct 23, 2014
96431ac
improve on auto-completion
Oct 23, 2014
8a12534
update Def position when parsing
Oct 23, 2014
0458a73
synchronize editor with outline when double clickous
Oct 23, 2014
fd4abd2
indent next line by indentation of the nearest and prior non-whitespa…
Oct 23, 2014
7e0b0e7
show selected item in call stack
Oct 25, 2014
86504cb
change priority of some tasks
Oct 30, 2014
775d46f
Merge branch 'master' into HEAD
Oct 30, 2014
fb4d98d
add path to debugger
Oct 30, 2014
fa65769
save all files before compiling
Nov 2, 2014
57b437a
show CompilerOutput without affecting shortcut keys
Nov 2, 2014
3a65883
minor changes
Nov 2, 2014
278df3c
change completion priority
Nov 3, 2014
1cb716e
keep empty trailing lines when comment/uncomment block of code
Nov 4, 2014
6c8353a
update location in parser
Nov 19, 2014
14f0cd7
search definitions in a locally aliased module
Nov 24, 2014
03ce5e6
improve search defns of locally aliased modules
Nov 24, 2014
954de54
search for auto-completion in locally aliased modules
Nov 24, 2014
801d0b6
improve auto-completion
Nov 25, 2014
c7ae8fc
Improve new-line-and-indent
Jan 24, 2015
540cebc
Improve new-line-and-indent
Jan 24, 2015
90f0c3e
using outline tree to enhance auto-completion
Jan 24, 2015
4b093d8
jump to definition: nested and aliased module is supported
Jan 25, 2015
7b18f7a
use both ml & mli files (even for the same module) to find completion…
Jan 26, 2015
360e0f5
improve completion proposals
Jan 26, 2015
6d37968
disable log
Jan 27, 2015
40b659c
provide hyperlink presenter for OcamlEditor
Jan 27, 2015
96d5abb
disable error log
Feb 4, 2015
4b744e3
improve switch comment
Feb 8, 2015
2351d5b
improve outline, support *
Feb 9, 2015
217ed11
minor
Feb 9, 2015
943e7f9
support cppo syntax
Apr 1, 2015
5e2b52f
improve cppo parser
Apr 1, 2015
6ce3faa
fix cppo grammar
Jun 12, 2015
c17ea2a
syntax highlight bold docs comment
Jun 16, 2015
d7900fd
improve shift-left indentation
Jun 16, 2015
7bad5b1
Improve OcamlPath
Jun 18, 2015
9b7f8ab
Synchronize and Goto Outline
Dec 26, 2015
f1739a2
Merge remote-tracking branch 'origin/cppo'
Dec 26, 2015
2cda1be
improve Synchronize and Goto Outline
Dec 26, 2015
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
Empty file modified Ocaml/icons/markOccurrence.gif
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Ocaml/icons/shiftLeft.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Ocaml/icons/shiftRight.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Ocaml/lib/beaver-cc.jar
Binary file not shown.
382 changes: 332 additions & 50 deletions Ocaml/plugin.xml

Large diffs are not rendered by default.

25 changes: 19 additions & 6 deletions Ocaml/src/ocaml/FolderChangeListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ public boolean visit(IResourceDelta delta) throws CoreException {
switch (delta.getKind()) {
case IResourceDelta.ADDED: {

// ignore special directories (.settings, .git, .cvsignore, etc.)
// ignore special directories (.settings, .git, .cvsignore, etc.) but not "."
IResource r = res;
while (r != null) {
if (r.getName().startsWith("."))
String rName = r.getName();
if (rName.startsWith("."))
return false;
r = r.getParent();
}
Expand All @@ -55,12 +56,24 @@ public boolean visit(IResourceDelta delta) throws CoreException {
if(res.getName().equals("_build"))
return false;

// add this path to the project paths
// add this path to the project paths when necessary
OcamlPaths paths = new OcamlPaths(project);
String[] strPaths = paths.getPaths();
String[] newPaths = new String[strPaths.length + 1];
System.arraycopy(strPaths, 0, newPaths, 0, strPaths.length);
newPaths[strPaths.length] = res.getProjectRelativePath().toPortableString();
String resPath = res.getProjectRelativePath().toPortableString();

boolean needAdd = true;
for (String s: strPaths) {
if (s.compareTo(resPath) == 0) {
needAdd = false;
break;
}
}
String[] newPaths = strPaths;
if (needAdd) {
newPaths = new String[strPaths.length + 1];
System.arraycopy(strPaths, 0, newPaths, 0, strPaths.length);
newPaths[strPaths.length] = resPath;
}
paths.setPaths(newPaths);

break;
Expand Down
9 changes: 9 additions & 0 deletions Ocaml/src/ocaml/OcamlPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import java.io.File;
import java.net.URL;
import java.util.HashMap;

import ocaml.debugging.OcamlDebugger;
import ocaml.editor.syntaxcoloring.OcamlPartitionScanner;
Expand All @@ -51,6 +52,7 @@
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
Expand All @@ -72,6 +74,8 @@ public class OcamlPlugin extends AbstractUIPlugin {

/** The singleton instance of the plug-in. */
private static OcamlPlugin instance = null;

public static HashMap<String, IProgressMonitor> ActiveBuildJobs = new HashMap<>();

/** The directory in which the plug-in was started. */
private final String pluginDirectory;
Expand Down Expand Up @@ -396,6 +400,11 @@ public static boolean getCommentIsBold() {
return instance.getPreferenceStore().getBoolean(PreferenceConstants.P_BOLD_COMMENTS);
}

/** Returns whether comments should appear in bold (from the user preferences) */
public static boolean getDocsCommentIsBold() {
return instance.getPreferenceStore().getBoolean(PreferenceConstants.P_BOLD_DOCS_COMMENTS);
}

/** Returns whether constants should appear in bold (from the user preferences) */
public static boolean getConstantIsBold() {
return instance.getPreferenceStore().getBoolean(PreferenceConstants.P_BOLD_CONSTANTS);
Expand Down
7 changes: 0 additions & 7 deletions Ocaml/src/ocaml/build/graph/CompilerVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;

/**
* Visit a graph layer by layer, to compile all vertices in the right order.<br>
Expand Down
4 changes: 2 additions & 2 deletions Ocaml/src/ocaml/build/makefile/OcamlMakefileBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ protected IStatus run(IProgressMonitor monitor) {
public void run() {
try {
project.refreshLocal(IProject.DEPTH_INFINITE, null);
} catch (CoreException e1) {
OcamlPlugin.logError("ocaml plugin error", e1);
} catch (Exception e) {
// OcamlPlugin.logError("ocaml plugin error", e);
}
}
});
Expand Down
34 changes: 18 additions & 16 deletions Ocaml/src/ocaml/debugging/OcamlDebugger.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public enum State {

/** The project containing the debugged executable */
private IProject project;

/** list of paths of project */
private String[] projectPaths;

Expand Down Expand Up @@ -240,20 +240,22 @@ public synchronized void start(
pathStr = pathStr.trim();
if (!".".equals(pathStr)) {
commandLineArgs.add("-I");

//These paths are either absolute or relative to the project
//directory. We must convert them to absolute paths in case
//we are running a bytecode within a nested directory.
Path path = Paths.get(pathStr);
if (!path.isAbsolute()) {
path = Paths.get(projectLocation.append(pathStr).toOSString());
}
commandLineArgs.add(path.toString());
commandLineArgs.add(path.toString());
}
}

// add the _build folder (for the cases making project by using Ocamlbuild)
String buildpath = projectLocation.append("_build").toOSString();
commandLineArgs.add("-I");
commandLineArgs.add(buildpath);
ArrayList<String> buildFolders = FileUtil.findSubdirectories(buildpath);
for (String path: buildFolders) {
commandLineArgs.add("-I");
Expand Down Expand Up @@ -429,7 +431,7 @@ public synchronized void backstepReturn() {
send("start");
}
}

public synchronized void setFrame(int frame) {
if (!checkStarted())
return;
Expand Down Expand Up @@ -831,7 +833,6 @@ public void run() {
refreshEditor();
state = State.Idle;
}

else if (state.equals(State.Frame)) {
processFrame(output);
debuggerOutput.setLength(0);
Expand Down Expand Up @@ -903,7 +904,7 @@ else if (state.equals(State.Quitting)) {
}

}

private void getFrame() {
state = State.Frame;
send("frame");
Expand Down Expand Up @@ -1091,7 +1092,7 @@ private void processFrame(String output) {

public static final Pattern patternCallstack = Pattern
.compile("\\A#(\\d+)\\s+Pc\\s*:\\s+(\\d+)\\s+(\\w+)\\s+char\\s+(\\d+)");

private void processCallStack(final String output) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
Expand Down Expand Up @@ -1138,7 +1139,7 @@ public void run() {

// prettier stackview
String newOutput = "#" + s1 + " - " + module + "." + functionName
+ " - (" + line + ": " + column + ")";
+ " - (" + line + ": " + column + ")";
backtrace[i] = newOutput;
} else {
OcamlPlugin.logError("ocamldebugger: couldn't parse call stack");
Expand All @@ -1156,7 +1157,7 @@ public void run() {
}
});
}

// get function that contains line
private synchronized String findFunctionContainingLine(String filepath, int line) {
String functionName = "";
Expand All @@ -1167,20 +1168,20 @@ private synchronized String findFunctionContainingLine(String filepath, int line
int i = 0;
for (i = 0; i < childs.size(); i++) {
Def def = childs.get(i);
int l = Symbol.getLine(def.posStart);
if (l >= line )
int l = Symbol.getLine(def.posStart);
if (l >= line )
break;
}
if (i > 0) {
Def child = childs.get(i-1);
if (child.type == Def.Type.Let)
functionName = child.name;
else if (child.type == Def.Type.Module) {
else if (child.type == Def.Type.Module) {
List<Def> grandChilds = child.children;
int j = 0;
for (j = 0; j < grandChilds.size(); j++) {
Def def = grandChilds.get(j);
int l = Symbol.getLine(def.posStart);
int l = Symbol.getLine(def.posStart);
if (l > line)
break;
}
Expand All @@ -1192,7 +1193,7 @@ else if (child.type == Def.Type.Module) {
}
return functionName;
}

private void indicateRunningState(final String message) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
Expand All @@ -1213,7 +1214,7 @@ public void run() {
DebugMarkers.getInstance().clearCurrentPosition();
refreshEditor();
}

private synchronized IEditorInput getEditorInput(final String filename)
{
String ufilename = filename.substring(0, 1).toUpperCase() + filename.substring(1);
Expand Down Expand Up @@ -1277,6 +1278,7 @@ private synchronized String getFilePath(final String filename)
return null;
}


public void highlight(final String filename, final int offset) {
final IEditorInput editorInput = getEditorInput(filename);
if (editorInput != null) {
Expand Down Expand Up @@ -1446,7 +1448,7 @@ public void run() {
}
});
}

public void printMessage(final String message) {
final IOConsoleOutputStream console = this.console;

Expand Down
4 changes: 1 addition & 3 deletions Ocaml/src/ocaml/debugging/views/OcamlCallStackView.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Rectangle;
Expand All @@ -30,10 +28,10 @@ public void setCallStack(String elements[]){
list.removeAll();
for(String e : elements)
list.add(e);
list.setRedraw(true);
if (selectionIndex >= 0 && selectionIndex < elements.length) {
list.setSelection(selectionIndex);
}
list.setRedraw(true);
}

public void empty(){
Expand Down
91 changes: 91 additions & 0 deletions Ocaml/src/ocaml/editor/actions/CancelCompileAllProjectsAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package ocaml.editor.actions;

import java.util.Collection;

import ocaml.OcamlPlugin;
import ocaml.editors.OcamlEditor;
import ocaml.editors.lex.OcamllexEditor;
import ocaml.editors.yacc.OcamlyaccEditor;
import ocaml.util.Misc;
import ocaml.views.OcamlCompilerOutput;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.part.FileEditorInput;

/** This action activates completion in the OCaml editor. */
public class CancelCompileAllProjectsAction implements IWorkbenchWindowActionDelegate {

private IWorkbenchWindow window;

public void run(IAction action) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IEditorPart editorPart = page.getActiveEditor();
if (editorPart != null) {
IProject project = null;
FileEditorInput editorInput = (FileEditorInput) editorPart.getEditorInput();
if (editorInput != null && editorInput.getFile() != null) {
project = editorInput.getFile().getProject();
}

if (project == null)
return;

// show compiler output
Misc.showView(OcamlCompilerOutput.ID);
// then activate current editor (to resolve shortcut-key issues)
page.activate(editorPart);

final String jobName = "Cancelling compiling jobs";

Job job = new Job(jobName) {
@Override
protected IStatus run(IProgressMonitor monitor) {
if (!OcamlPlugin.ActiveBuildJobs.isEmpty()) {
// cancel all jobs
Collection<IProgressMonitor> monitors = OcamlPlugin.ActiveBuildJobs.values();
for (IProgressMonitor m: monitors) {
m.setCanceled(true);
}
// clear them from store
OcamlPlugin.ActiveBuildJobs.clear();
}
return Status.OK_STATUS;
}
};

job.setPriority(Job.BUILD);
job.setUser(action != null);
job.schedule(50);
}else
OcamlPlugin.logError("ContentAssistAction: editorPart is null");
} else
OcamlPlugin.logError("ContentAssistAction: page is null");

}

public void dispose() {
}

public void init(IWorkbenchWindow window) {
this.window = window;
}

public void selectionChanged(IAction action, ISelection selection) {
}

}
Loading