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

c 头文件定位问题 #28

Open
xm-tech opened this issue Mar 25, 2023 · 3 comments
Open

c 头文件定位问题 #28

xm-tech opened this issue Mar 25, 2023 · 3 comments

Comments

@xm-tech
Copy link

xm-tech commented Mar 25, 2023

比如类似下面的 c 代码, 假若想 \f d 定位到 SDL_Window 会失败

同样定位到 c 语言库函数 比如 qsort 中的源码也会失败

想问下这种大家一般是如何修正的呢 @skywind3000

image

@xm-tech xm-tech changed the title vim 系统头文件定位问题 c 头文件定位问题 Mar 25, 2023
@xm-tech
Copy link
Author

xm-tech commented Mar 25, 2023

防止看不到图片,贴下代码

#ifndef GAME_H
#define GAME_H

#include <SDL2/SDL.h>
#include <stdlib.h>

#define GAME_NAME "MELOBALL"
#define WIDTH 380
#define HEIGHT 640
#define FRAME_RATE 50 // 1秒 50 帧
#define MOVE_SPEED 10

#define BG_COLOR 0xffffffff
#define RECT_WIDTH 80
#define RECT_HEIGHT 10
#define RECT_COLOR 0x00885533

typedef struct {
	SDL_Window *win;
	SDL_Surface *scene;
	int x;
	int y;
} game;

void start_game();

#endif

@xm-tech
Copy link
Author

xm-tech commented Mar 25, 2023

当然我通过 手动指定路径可以解决定位跳转的问题, 类似:

set path+=/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/
set path+=/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/

" to locate the SDL sourcefile
set path+=/usr/local/Cellar/sdl2/2.24.0/include/

但这种方式觉得还是蛮蠢的,因为当文件升级后需要再次更新该路径

而且是通过 vim 自身的: [-ctrl-i 的方式跳转过去的, \f d 依旧失败

@skywind3000
Copy link
Owner

请用 LSP 来实现符号定位。

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