ramon-rocha / monodevelop.cobrabinding Goto Github PK
View Code? Open in Web Editor NEWAdds support for the Cobra programming language to MonoDevelop
Adds support for the Cobra programming language to MonoDevelop
When using the Mono runtime, the Cobra library cannot be found unless the Cobra.Core.dll or Cobra.Lang.dll file is copied into the output folder of the project (i.e. same folder as generated assembly). The program will run successfully when running via .NET. This may be a path/environment variable issue.
On Windows/.NET, adding a reference to a package, as opposed to directly to an assembly such as a .dll, results in the following messages when attempting to compile the project:
error: COBRA INTERNAL ERROR / Win32Exception / The system cannot find the file specified
This is due to the Cobra compiler trying to execute the "pkg-config --lib <package_name>" which is not typically available on Windows.
A more appropriate error message should be displayed or the assemblies contained in the package should be passed to the compiler using the "-ref" option instead of the "-pkg" option. See here: https://github.com/ramon-rocha/MonoDevelop.CobraBinding/blob/master/CobraBinding/CobraLanguageBinding.cobra#L96
Sometimes, if a project contains folders, they will be passed to the Cobra compiler which result in an error message. They should be excluded from the list of files to compile. Originally it seemed this issue only existed on Windows but it was also recently encountered while working in the 'parser' branch of the addin.
Mono fails to resolve dependencies for MonoDevelop.Ide.dll since Cobra has switched to reflection-only-loading on Mono/CLR 4.
The workaround is to add the path to the assembly via the MONO_PATH environment variable during compilation.
When accepting a generic completion proposal such as List<of
a trailing space should be included in the completion text. This way, the developer can immediately start entering the name of the type.
We might want to make this optional based on preference in the future.
Steps:
The classes come up in C#. There is a "Language:" pulldown with choices: C#, IL, Summary.
What we want is a "Cobra" choice and for it to be the default for Cobra projects.
Not sure what's going on here yet.
This is essentially the same bug as issue #9. It's back...
There should be no completion proposals when making a new declaration such as:
def _
or def foo_
This would include any type of declaration such as classes, methods, fields, etc.
Completion proposals should resume after the identifier has been entered.
Without a proper line parser, for now we'll just handle the common cases which should be detailed in https://github.com/ramon-rocha/MonoDevelop.CobraBinding/blob/completion/CobraBinding/manual_tests/completion.txt
By default, a project in a "Debug" configuration will have the "Debugging Tips" option enabled. This creates confusion when debugging since any exceptions that get thrown will get caught by main. The last line of main will appear to be the source of the exception.
"Debugging Tips" should not be a user option and always set to 'false' behind the scenes.
If a class contains a sig
declaration, this breaks the ensure contract in _createNodeMap.
ensure
all for node in regionMap.keys get node in result.values
all for region in regionMap.values get region in result.keys
The problem appears to be that MethodSig
inherits from Class
and has some declarations but its child methods resolve to the same DomRegion
as their container which is causing some issues with the symbol table.
Due to this: mono/monodevelop@f57fbcd#L3R710
the Cobra compiler cannot compile the addin anymore since it references the MonoDevelop library. The cause is that the field diffTracker
and the property DiffTracker
both map to the name diffTracker
in Cobra.
Cobra ticket here: http://cobra-language.com/trac/cobra/ticket/343
I added:
def foo
pass
to my class above "def main" and then went back to .main and typed: .f
I did not get any completion choices. It says "no matches". I'm expecting "foo".
Environment is MonoDevelop 3.0.5 on Mono 2.10.9 on Mac 10.6.8 on latest 'completion branch' from Sat 2013-02-09 around midday pacific time.
We want all appropriate extension methods to be displayed as dot completion proposals including things like .toTechString
included for all objects and .md5HashInHex
included for Strings.
We want smarter indentation when hitting Enter after def foo
, cue init
, etc.
We probably want to implement a TextEditorExtension dedicated to this task. Reference material:
s = "hello \" escaped quote"
After entering the preceeding Cobra code in MonoDevelop, the addin will begin to show completion proposals for the letter e
because it thinks the string has been terminated.
This will need to be addressed from the 'tooltips' codebase as it includes some new methods for determining if a line of text is an unfinished string: https://github.com/ramon-rocha/MonoDevelop.CobraBinding/blob/tooltips/CobraBinding/TypeSystem/Parser.cobra#L637 It has a bug!
http://cobra-language.com/forums/viewtopic.php?p=4927#p4927
In CobraLanguageBinding.Compile(), the process StartInfo.FileName is set to 'c:\cobra\bin\cobra.bat' on Windows or just 'cobra' otherwise. Neither of these work for OS X and requires that the process StartInfo.WorkingDirectory be set to "/".
The syntax for types using nested generics such as Dictionary<of String, List<of int>>
is not properly highlighted.
Failed!
$ /Library/Frameworks/Mono.framework/Commands/pkg-config --libs monodevelop
| Package monodevelop was not found in the pkg-config search path.
| Perhaps you should add the directory containing `monodevelop.pc'
| to the PKG_CONFIG_PATH environment variable
| No package 'monodevelop' found
Compilation failed - 1 error, 0 warnings
No clue on this one. I have no Mac to test on.
I need to merge some of the fixes from the completion branch into master since svn-2966 includes better nil checking with method overloads which prevents the addin from compiling. I may just end up merging the entire branch.
When I type this statement in a method body (and before hitting Return):
i = 5
I often get an autocompletion menu with choices like:
IDictionary<of TKey,TValue>.extension.396546
...
Environment is MonoDevelop 3.0.5 on Mono 2.10.9 on Mac 10.6.8 on latest 'completion branch' from Sat 2013-02-09 around midday pacific time.
Before I start to document this, let me ask you if you want me to bother with it yet. In short, if I push F5 (or otherwise try to run while debugging), MD3.0x experiences an exception. I would post the incredibly arcane and lengthy error msg for you, but I believe you're already aware of this problem based on your comments over at the Cobra chat.
So let me know if you want me to say more.
On both MonoDevelop 4.0 under Ubuntu, and Xamarin Studio 4.0 under Windows 7, code syntax highlighting appears to be entirely non-functional for the most current version of the addin.
I haven't looked at all into the why, and I don't know if it is a serious issue (given that it is not the most recent version), but it seems worth noting, if for nothing other than future reference as a know issue.
For identifiers, display a tooltip showing the declaration/signature.
For keywords, show the grammar and a text description.
Inside a "def main" I go to type "String." to look at the static methods of the String class. But just before the ".", I'm presented with an autocompletion list with one item "toString". This is incorrect in that without a preceding "." the autocompletion choices should not be methods. The choices should be either blank or a list of accessible types (or local vars or params if I had any, but I don't in this case).
Then when I hit "." after typing "String", the text becomes "toString.".
In summary, typing "String" as the beginning of a statement gives the wrong autocompletion list.
This is a regression introduced by commit 64f050e.
s = 'foo'
s.replace('f', 'c')._
The current Box members are displayed as completion proposals instead of the members for the replace
method.
Example:
"def foo as "
Typing "as " does not match the as
keyword and instead wants to match ArraySegment<of T>
. Likewise, "ref " does not match the ref
keyword and instead wants to match WeakReference<of T>
.
I suspect this is because the space is being included in the triggerword. This is a change in behavior from MonoDevelop 3.0.6 introduced with MonoDevelop 4.0.
Still doing research on this one. We need to add an extension point to the addin.xml file and a command handler class.
We can make use of http://cobra-language.com/trac/cobra/changeset/3017
The command should either jump to the correct file and line number or open the assembly browser for declarations from references.
In the latest version of MonoDevelop from master on Linux, Cobra projects don't build anymore. At least, not without unchecking the option to use MSBuild in the Project options.
I need to find a way to make sure this is not checked when creating a Cobra project. Either that or I need to add MSBuild support.
I get this error:
error: COBRA INTERNAL ERROR / UnauthorizedAccessException / Access to the path "//MainWrapper.cobra.cs" is denied.
Build: 1 error, 0 warnings
When compiling this code:
class P
def main
print 'done.'
Located in this path:
~/Dropbox/Projects/Cobra/workspace-u/Source
But I can compile the above code from the command line with:
$ cobra -c p.cobra
Compilation succeeded
Maybe the working/starting directory of the process that compiles can be set to the directory of the source file (or in the case of a project, the project directory). I think we might need this anyway if the code has "@ref SomeLibrary" where SomeLibrary.dll is in the same directory.
In this case, I don't have a project or solution open. I'm just using MonoDevelop on a single random file.
This doesn't highlight correctly and causes multiple following lines to highlight as a string:
var charsToIgnore = @[
c',',
c')',
c'[',
c']',
c'"',
c"'",
]
The workaround is to add
#'
on the following line.
This used to look okay before MonoDevelop 4.0/Xamarin Studio when they were blue blob things, but now they are all capital letter "F"s. We need different icons for locals and params in completion data lists.
Currently, if a single source file is opened without a project, the generated EXE file will be created in a bin/Debug folder in the same location as the source file.
Ideally, the EXE file should be created in the same folder as the source code file without the creation of a bin/Debug folder.
Note, however, that this behavior would not match the default behavior in MonoDevelop for single source files of other languages, such as C#, which also create an EXE in a bin/Debug folder.
For example, typing l = List<of
_ should display the following tooltip for the List<of
completion data entry:
class System.Collections.Generic.List<of T>
Fix with issue #31
This is a regression introduced when updating the addin to support XS and MD4.
Given an empty doc string like:
class MyProgram
"""
"""
I open it up (underscore just represents cursor):
class MyProgram
"""
_
"""
And when I type "String", I get an autocompletion menu. I shouldn't get any autocompletion inside doc strings.
Sometimes it doesn't happen. But if I try several times, it will hit.
All lines following '\''
are treated as a string literal until another single quote character is found.
class Test
def abc
if "xyz".contains('\'')
print "things look good."
This is similar to issue #14 and has the same workaround. Add
# '
to the end of the line containing the escaped quote. Alternatively, wrapping the string in double-quotes when a single quote is required in the string literal (and vice-versa) is another workaround.
if "xyz".contains("'")
When I type in a normal method body:
print 'String
It says "no matches" in a pulldown. But I'm inside a string lit (and not a sub-expression thereof) so there should be no autocompletion.
When we call a method or create a new object, we want to be presented with tooltips that relay information to the developer about the available parameters and overloads.
The data should be displayed automatically when entering the (
character or when hitting Ctrl+Shift+Space and inside a finished or unfinished call (like in the C# binding).
The following code does not highlight correctly
msbuildPaths = @[
'[root][__s]Microsoft.NET[__s]Framework[__s]v4.0.30319[__s]MSBuild.exe',
'[root][__s]Microsoft.NET[__s]Framework[__s]v2.0.50727[__s]MSBuild.exe',
]
Man, this is a big bug. If the first line of a source starts with class
or some other container that encompasses the rest of the file, then it throws off the logic that determines which DOM region the cursor is in.
This will require some more investigation to identify where the problem is.
Even running with the Mono runtime as opposed to .NET, I was not able to get the debugger to stop execution at breakpoints. I'm not sure what is causing this.
It is unknown if this is an issue with MonoDevelop, the Cobra addin, the assembly generated by Cobra, or some combination of the three.
In CobraCompletionTextEditorExtension, it is possible for the object returned by .document
to change in between calls to .ast
, .symbolTable
, and .regionMap
To resolve this issue, we must ensure that the same document instance is used to retrieve the other relevant objects.
I followed the instructions for Win7 x64, and everything seemed to go ok. I get Cobra as an option when creating a new solution. I'm using MD 3. Syntax highlighting works, and I can create files using the different templates.
But when I try to compile anything (e.g. the example console app) I get the message "Build failed. The system cannot find the file specified". I can see it created a bin/Debug folder but there's nothing in it.
Full output:
Building: TestCobra (Debug|x86)
Performing main compilation...
---------------------- Done ----------------------
Build successful.
Build failed. The system cannot find the file specified
How do I find out what file it's looking for?
I've tried targeting both NET and Mono, I get the same thing.
minor suggestion -- (at least) in Windows we need a readkey in the default "Hello World' project. from the command line, we obviously don't need it, but using MD we can't get any visible confirmation of "Hello World" without the readkey statement.
""
Replace this text with a description of your program.
"""
class MyProgram
def main
print 'Hello, world!'
Console.readKey
UPDATE
False alarm, but I couldn't find any way in the github software to delete the "issue", other than to edit and remove the contents, leaving this empty issue. If there's a "delete" button around here somewhere, couldn't find it. Could edit. Could close. Couldn't delete.
The installer fails if the CobraBinding/bin/Debug folder does not exist. It should create it if it does not exist before compiling the addin.
New branch created. Some issues remain.
Waiting for the dust to settle before proceeding...
When typing:
Object.equals(._
A require contract in CobraCompletionTextEditorExtension._getNodeFromIds is violated.
require
ids.count > 0
containingRegions.count > 0
The problem most likely lies in CobraCompletionTextEditorExtension._resolveTextToNode
More investigation is required.
This used to be supported but was removed for performance reasons. Eventually we want to add it back in. We want to be able to type:
System
and then hit '.' and get all the sub namespaces under System
as completion proposals.
All namespaces from referenced assemblies should be handled the same way.
For now, what does work is adding a use directive for the desired namespace and its declarations will be made available as completion proposals.
Note, the following use directives are implicit for all Cobra code:
use System
use System.Collections.Generic
use System.IO
use System.Text
use Cobra.Core
http://cobra-language.com/trac/cobra/wiki/UseDirective
So, add use Foo.Bar
in the interim to the top of your file to make the classes in that namespace available as completion results.
When attempting to create a new Cobra source file via the File > New menu without an open project, an exception is thrown and the file is not created. This because the fileName is nil at this point and both the Folding parser and TypeSystem parser are expecting a non-nilable fileName.
Opening an existing file outside the context of a solution/project works correctly as does adding a new file to a solution/project.
The workaround at this point is to create the file outside of MonoDevelop and then open it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.