Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Enable search-based intelligence for Objective C. #197

Merged
merged 4 commits into from
Jan 24, 2020
Merged

Conversation

creachadair
Copy link

@creachadair creachadair commented Jan 24, 2020

Since Objective C shares header file extensions with C and C++, this change treats Objective C as a dialect of C++ for the purpose of basic code intelligence. This is a mild (and arguably reasonable) compromise to the convention that each language has its own extension: We already treat C and C++ as one language, and since Objective C subsumes native C syntax as well, it makes sense to allow them to share filtering logic.

The substance of this change is to add the .m file extension to the C++ extension, and to extend the import filter to allow #import and @import directives as well as #include. For (correct) native C and C++ code, these extensions will have no material effect.

Fixes https://github.com/sourcegraph/sourcegraph/issues/6655.

@creachadair creachadair force-pushed the mjf-newlangs branch 2 times, most recently from 2a7e019 to 559e89f Compare January 24, 2020 00:47
Copy link
Contributor

@chrismwendt chrismwendt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs more thought, but there might be another way to solve this that's more in line with having 1 extension for each language, e.g. by running both the CPP and Objective C extensions and checking the file content to determine which language it is.

@creachadair creachadair force-pushed the mjf-newlangs branch 3 times, most recently from 96d87cd to c69266e Compare January 24, 2020 19:10
@creachadair creachadair marked this pull request as ready for review January 24, 2020 19:19
@creachadair creachadair requested a review from a team as a code owner January 24, 2020 19:19
@creachadair creachadair requested a review from a team January 24, 2020 19:19
@creachadair creachadair self-assigned this Jan 24, 2020
Notably: Upgrade prettier to 1.19.1, to support newer syntax.
This also fixes a lifecycle error by running under yarn rather than npm.
Since Objective C shares header file extensions with C and C++, this commit
treats Objective C as a dialect of C++ for the purpose of code intelligence.
In addition to adding the .m file extension, it extends the import filter to
allow #import and @import directives as well as #include.

For native C and C++ code, these extensions will have no material effect.
@creachadair
Copy link
Author

I merged #175 into this PR (with distinct commits) and cleaned up the history. CI is happy again.

Copy link
Contributor

@felixfbecker felixfbecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@creachadair
Copy link
Author

Any objections to me merging this with the affiliated (but not directly related) formatting changes?

@chrismwendt
Copy link
Contributor

Any objections to me merging this with the affiliated (but not directly related) formatting changes?

Not at all, that's fine, especially because the formatting is isolated to one commit.

@creachadair creachadair merged commit 31ec357 into master Jan 24, 2020
@creachadair creachadair deleted the mjf-newlangs branch January 24, 2020 21:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basic intellisense for objective-C
3 participants