-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Base implementation of autocomplete #849 #6235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bfedcba
fixed eclipse (neon) classpath
ricardojlrufino 5d64faf
Base implementation of autocomplete #849
ricardojlrufino dff2e32
Refactoring autocomplete structure
ricardojlrufino 665ac88
fix windows build - add autocomplete libs
ricardojlrufino 349827a
[completions] Add GPL header and move setup function to EditorTab
ricardojlrufino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
40 changes: 40 additions & 0 deletions
40
app/src/cc/arduino/autocomplete/BaseCCompletionProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ | ||
|
||
/* | ||
Part of the Arduino project - http://www.arduino.cc | ||
|
||
Copyright (c) 2015 Matthijs Kooijman | ||
Copyright (c) 2004-09 Ben Fry and Casey Reas | ||
Copyright (c) 2001-04 Massachusetts Institute of Technology | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License version 2 | ||
as published by the Free Software Foundation. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
|
||
package cc.arduino.autocomplete; | ||
|
||
import org.fife.ui.autocomplete.DefaultCompletionProvider; | ||
|
||
/** | ||
* Base completion provider for C/C++. | ||
* @author Ricardo JL Rufino ([email protected]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May you add a GNU GPL license on top of all the files and move the credits there? |
||
* @date 28/04/2017 | ||
*/ | ||
public class BaseCCompletionProvider extends DefaultCompletionProvider{ | ||
|
||
@Override | ||
protected boolean isValidChar(char ch) { | ||
return super.isValidChar(ch) || '.' == ch || '>' == ch || '-' == ch || '<' == ch || '#' == ch || ':' == ch /**|| getParameterListStart() == ch */; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
app/src/cc/arduino/autocomplete/FakeCompletionProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ | ||
|
||
/* | ||
Part of the Arduino project - http://www.arduino.cc | ||
|
||
Copyright (c) 2015 Matthijs Kooijman | ||
Copyright (c) 2004-09 Ben Fry and Casey Reas | ||
Copyright (c) 2001-04 Massachusetts Institute of Technology | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License version 2 | ||
as published by the Free Software Foundation. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
|
||
package cc.arduino.autocomplete; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import javax.swing.text.JTextComponent; | ||
|
||
import org.fife.ui.autocomplete.BasicCompletion; | ||
import org.fife.ui.autocomplete.Completion; | ||
|
||
import processing.app.syntax.SketchTextArea; | ||
|
||
public class FakeCompletionProvider extends BaseCCompletionProvider { | ||
|
||
@Override | ||
protected List<Completion> getCompletionsImpl(JTextComponent comp) { | ||
List<Completion> list = new LinkedList<>(); | ||
|
||
SketchTextArea area = (SketchTextArea) comp; | ||
|
||
list.add(new BasicCompletion(this, "Text: " + getAlreadyEnteredText(comp))); | ||
list.add(new BasicCompletion(this, "Line: " + area.getCaretLineNumber())); | ||
|
||
return list; | ||
} | ||
|
||
|
||
} |
50 changes: 50 additions & 0 deletions
50
app/src/cc/arduino/autocomplete/SketchCompletionProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ | ||
|
||
/* | ||
Part of the Arduino project - http://www.arduino.cc | ||
|
||
Copyright (c) 2015 Matthijs Kooijman | ||
Copyright (c) 2004-09 Ben Fry and Casey Reas | ||
Copyright (c) 2001-04 Massachusetts Institute of Technology | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License version 2 | ||
as published by the Free Software Foundation. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
|
||
package cc.arduino.autocomplete; | ||
|
||
import org.fife.ui.autocomplete.CompletionProvider; | ||
import org.fife.ui.autocomplete.LanguageAwareCompletionProvider; | ||
|
||
import processing.app.Sketch; | ||
import processing.app.syntax.SketchTextArea; | ||
|
||
/** | ||
* CompletionProvider for Arduino/CPP Language. <br/> | ||
* Setup basic logic for completions using {@link LanguageAwareCompletionProvider}. <br/> | ||
* Filtering and decision will appear in the autocomplete dialog by implementations of: {@link CompletionProvider}.<br/> | ||
* | ||
* @author Ricardo JL Rufino ([email protected]) | ||
* @date 28/04/2017 | ||
*/ | ||
public class SketchCompletionProvider extends LanguageAwareCompletionProvider { | ||
|
||
public SketchCompletionProvider(Sketch sketch, SketchTextArea textArea, CompletionProvider provider) { | ||
|
||
setDefaultCompletionProvider(provider); | ||
// provider.setParameterChoicesProvider(new ParameterChoicesProvider(this)); | ||
// provider.setParameterizedCompletionParams('(', ", ", ')'); | ||
|
||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the autocomplete library here?
https://github.com/bobbylight/AutoComplete
where did you found the jar?
I think that the launchers for Windows must be updated too:
build/windows/launcher/config.xml
build/windows/launcher/config_debug.xml