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

Automatically search for grammar on GitHub when none is configured yet #157

Open
mickaelistria opened this issue May 3, 2018 · 15 comments

Comments

@mickaelistria
Copy link
Contributor

GitHub textmate organization is actually a repo of TextMate grammars. When a file is opened with Generic Editor and expects TM4E to participate but tm4e has no grammar, it should open a dialog to user suggesting to search for grammars on GitHub and allow to fetch them. A query like "<string>cpp</string>" user:textmate repo:*.tmbundle extension:plist (in case of .cpp) can for example show interesting results.

@mickaelistria mickaelistria changed the title Automatically search for grammar when not found Automatically search for grammar on GitHub when not found May 3, 2018
@mickaelistria mickaelistria changed the title Automatically search for grammar on GitHub when not found Automatically search for grammar on GitHub when none is configured yet May 3, 2018
@angelozerr
Copy link
Contributor

I love this great idea! But it means that we must use git protocol to download it?

@mickaelistria
Copy link
Contributor Author

GitHub does allow to access raw content of repos through http: https://raw.githubusercontent.com/textmate/c.tmbundle/master/Syntaxes/C.plist

@angelozerr
Copy link
Contributor

Yes you are right, but how we can map a textmate grammar with this URL? I mean genericeditor opens a file with extends .c, how we can discover the well URL https://raw.githubusercontent.com/textmate/c.tmbundle/master/Syntaxes/C.plist? Perhaps we should have a textmate serach engine which does that?

@angelozerr
Copy link
Contributor

An idea is to have a server like https://tmsearch.com/ which does the same thing for npm https://npmsearch.com/ (to find package)

@angelozerr
Copy link
Contributor

@ainslec perhaps this textmate search engine could b ean issue for https://eeyo.io/iro/ ? What do you think about that?

@mickaelistria
Copy link
Contributor Author

but how we can map a textmate grammar with this URL?

We don't map it, we send the search request to GitHub and tell user "We found this grammar from GitHub, do you want to use it?". No additional registry involved, GitHub is the registry and search engine.

@angelozerr
Copy link
Contributor

angelozerr commented May 4, 2018

"We found this grammar from GitHub, do you want to use it?"

Sorry I have not understood your idea?

An idea is that we could use teh APi Search of github https://developer.github.com/v3/search/

For instance:

{
  "total_count": 1673,
  "incomplete_results": false,
  "items": [
    {
      "id": 793799,
      "name": "SCSS.tmbundle",
      "full_name": "MarioRicalde/SCSS.tmbundle",
      "owner": {
        "login": "MarioRicalde",
        "id": 125900,
        "avatar_url": "https://avatars0.githubusercontent.com/u/125900?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/MarioRicalde",
....
{
  "total_count": 1,
  "incomplete_results": false,
  "items": [
    {
      "name": "SCSS.tmLanguage",
      "path": "Syntaxes/SCSS.tmLanguage",

@ainslec
Copy link

ainslec commented May 5, 2018

@angelozerr

perhaps this textmate search engine could b ean issue for https://eeyo.io/iro/ ? What do you think about that?

What kind of feature do you want it to be? I understand the concept of a .tmLanguage registry, but what role do you think Iro should play? Should it add an option to publish to a central registry, or provide a registry itself? Just trying to understand your comment.

@angelozerr
Copy link
Contributor

angelozerr commented May 5, 2018

What kind of feature do you want it to be?

Just having a textmate search engine like search textmate grammar .tmLanguage by file extension which links to grammar (not host the grammar, just give a link that we can download it)

@ainslec
Copy link

ainslec commented May 5, 2018

Problem is that Iro is a static web page, nothing more. And it doesn't store anything on the serverside (because there is no serverside).

Seems like the problem is not a tech problem, but a hosting problem. Maybe the Eclipse project can host the search engine?

@angelozerr
Copy link
Contributor

Seems like the problem is not a tech problem, but a hosting problem. Maybe the Eclipse project can host the search engine?

I think we can consume the Github API Search for that even if it's not perfect, but IMHO I think the better clean solution is to have a search engine like we have for npm.

@mickaelistria
Copy link
Contributor Author

Creating and hosting a search engine is not an affordable effort for this project (and is not really the topic of this issue initially) and I'm confident that sending good queries to GitHub search service would work well for the vast majority of cases.

@angelozerr
Copy link
Contributor

A query like "cpp" user:textmate repo:*.tmbundle extension:plist (in case of .cpp) can for example show interesting results.

Could you give me the right github URL which retrieves this grammar please?

@mickaelistria
Copy link
Contributor Author

I'm going submarine and doing only bugfix, releng or consolidation of existing features for Photon. I'll come back to this topic in a few weeks as discovery (of Docker based LS, or TM grammars) is likely to become a hot topic for me.

@angelozerr
Copy link
Contributor

Ok I wanted to start something, but if you have the intetion to do it, I let you implement this feature.

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

No branches or pull requests

4 participants