-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement auto-completion #3
Comments
The Class documentation can be helpful for this. List all ClassesClass.allClasses.do({|c|
c.postln;
nil;
}); Find all methods of a classArray.dumpAllMethods; returns
This also returns all Methods of all Superclasses. Find help for classArray.helpFilePath returns
This html file contains a link at the end to the schelp file which can be displayed nicer than HTML in a tooltip <div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Class.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Class.schelp</a><br>link::Classes/Class::<br></div></div><script src='./../editor.js' type='text/javascript'></script>
</body></html> |
A basic auto-complete is implemented but it is yet very buggy and has no intelligence in it - but regarding the reference implementation in SC IDE it seems there is no proper way to get the methods of an object. |
Taking a look at these resources could be helpful |
(
var methodExtractor = {|method|
(
name: method.name,
arguments: method.argNames.collect({|argName, i|
(
name: argName,
default: method.prototypeFrame[i],
)
});
)
};
x = Class.allClasses.collect({|class|
(
name: class.name,
sourceFile: class.filenameSymbol,
// meta class does not have helpFilePath implemented
helpFile: if(class.isMetaClass, {""}, {class.helpFilePath}),
methods: class.methods.collect({|m|
methodExtractor.value(m);
}),
classMethods: class.class.methods.collect({|m|
methodExtractor.value(m);
});
)
});
) one class as JSON becomes {
"classMethods": [
{
"arguments": [
{
"name": "this"
},
{
"default": 28,
"name": "columns"
},
{
"default": 7,
"name": "rows"
},
{
"default": 0.6,
"name": "lambda"
},
{
"default": 1.0,
"name": "sigma"
},
{
"default": 2,
"name": "singleEventsPerSec"
},
{
"default": 5,
"name": "maxEventOrder"
}
],
"name": "new"
},
{
"arguments": [
{
"name": "this"
},
{
"name": "lambda"
},
{
"name": "k"
}
],
"name": "poisson"
}
],
"helpFile": "file:\/\/\/Users\/scheiba\/Library\/Application Support\/SuperCollider\/Help\/Classes\/Aachorripsis.html",
"methods": [
{
"name": "columns"
},
{
"name": "rows"
},
{
"name": "lambda"
},
{
"name": "sigma"
},
{
"name": "maxEventOrder"
},
{
"name": "matrix"
},
{
"name": "p"
},
{
"arguments": [
{
"name": "this"
}
],
"name": "init"
},
{
"arguments": [
{
"name": "this"
},
{
"name": "eventType"
},
{
"name": "simEvents"
}
],
"name": "prInsertEvent"
}
],
"name": "Aachorripsis",
"sourceFile": "\/Users\/scheiba\/github\/aachorripsis\/Classes\/Aachorripsis.sc"
} Maybe we could parse the Help Files like in the IDE as well? |
this results in a 13mb JSON which is not really practical anymore :/ |
More ressources |
This seems to be a big task but it is definitely worth it.
Maybe SC autocomplete could be implemented via https://langserver.org/
Other implementations of an IDE such as vim, emacs or atom mostly rely on static keywords.
There is an interesting idea mentioned at crucialfelix/atom-supercollider#22 (comment)
The text was updated successfully, but these errors were encountered: