-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add c-sharp textobjects #3494
Add c-sharp textobjects #3494
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jumping around in some C# files I have locally, I think we should also have function textobjects for property definitions like:
public override bool CanRead {
get { return true; }
}
But I'm not sure if we should tag the entire property as function.around
(the property_declaration
node) or just the accessor declaration (accessor_declaration
node)
Also constructor definitions:
public BufferPoolStream(BufferPool bufferPool) {
if (bufferPool == null)
throw new ArgumentNullException("bufferPool");
_bufferPool = bufferPool;
}
(constructor_declaration body: (_) @function.inside) @function.around
Do you think it would be appropriate to map it like this until we have more precise navigation commands?
Note: To make About Class for testing. namespace NavigationTest {
public class ClassTest {
public int field = 0;
public int Field {
get { return field; }
set { field = value; }
}
public NavigationTest(string param1, int param2) {
// Set field.
field = param2;
}
~NavigationTest() {
}
/// Documentation.
///
/// Documentation.
public int Method(string param1, int param2) {
/* Multiline
comment.
*/
return 0;
}
}
public enum EnumTest {
Item1,
Item2
}
public interface InterfaceTest {
public void Method();
}
public struct StructTest {
public int field = 0;
}
public record RecordTest {
public int field = 0;
}
public record struct RecordStructTest {
public int field = 0;
}
} Let me know what you think. |
…nor improvements.
Looks great, thank you! |
Co-authored-by: Gustavo Bogarín <gbogarin@outlook.com> Co-authored-by: Gustavo Bogarín <gbogarin@posibillian.tech>
Co-authored-by: Gustavo Bogarín <gbogarin@outlook.com> Co-authored-by: Gustavo Bogarín <gbogarin@posibillian.tech>
Co-authored-by: Gustavo Bogarín <gbogarin@outlook.com> Co-authored-by: Gustavo Bogarín <gbogarin@posibillian.tech>
Co-authored-by: Gustavo Bogarín <gbogarin@outlook.com> Co-authored-by: Gustavo Bogarín <gbogarin@posibillian.tech>
This PR adds basic textobjext based navigation for c-sharp.