Skip to content
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

Support arbitrary sourcekit command? #312

Closed
keith opened this issue Dec 9, 2016 · 6 comments
Closed

Support arbitrary sourcekit command? #312

keith opened this issue Dec 9, 2016 · 6 comments

Comments

@keith
Copy link
Contributor

keith commented Dec 9, 2016

While working on some editor integrations I found myself wanting to use sourcekit to get some info about my files/modules. To do this I was planning on passing some compiler arguments, along with some other info, to sourcekit for various requests that aren't particularly supported with a custom command in sourcekitten.

What do you all think about adding the ability in sourcekitten to execute arbitrary sourcekit requests, rather than the ones that are already supported with custom arguments in sourcekitten, so that you could pass something like:

{
  key.request: source.request.cursorinfo,
  key.compilerargs: [
      ...
  ],
  key.offset: 123,
  key.sourcefile: "path/to/foo.swift"
}

through to sourcekit, without having to add a custom command in sourcekitten to handle this directly for every possible current, and future, sourcekit request. The benefit being you'd still be able to utilize the communication and parsing handled in sourcekitten, without having to have a command for each possible request.

@keith
Copy link
Contributor Author

keith commented Dec 9, 2016

Another possible solution to this problem would be for me to just use Request.customRequest from my own CLI/tool, and not from sourcekitten's CLI

@keith
Copy link
Contributor Author

keith commented Dec 9, 2016

Even better I could use Request.customRequest along with sourcekitd_request_create_from_yaml to do this pretty simply with some yaml files. But I'm still curious if you think this has a place in sourcekitten itself.

@jpsim
Copy link
Owner

jpsim commented Dec 9, 2016

Great idea! As you mentioned, the Request.customRequest is the right API for this, although a CLI command would be great.

@keith
Copy link
Contributor Author

keith commented Dec 9, 2016

I just submitted a slightly related PR which may or may not make sense to merge: #313 but this would allow consumers (possible for this usage) to pass yaml as well.

@jpsim
Copy link
Owner

jpsim commented Dec 9, 2016

nope, I think that's a great way to expose it

@keith
Copy link
Contributor Author

keith commented Dec 9, 2016

Awesome! I think this is definitely a good start since this would also mean we wouldn't have to convert the jsonish representation, instead we could just pass the yaml right through

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants