https://github.com/shader-slang/slang
Raw File
Tip revision: 5902acdabc4445a65741a7a6a3a95f223e301059 authored by Yong He on 23 January 2024, 07:19:40 UTC
[LSP] Fetch configs directly from didConfigurationChanged message. (#3478)
Tip revision: 5902acd
slang-language-server-ast-lookup.h
#pragma once

#include "slang-ast-all.h"
#include "slang-workspace-version.h"

namespace Slang
{
struct ASTLookupResult
{
    List<SyntaxNode*> path;
};
enum class ASTLookupType
{
    Decl,
    Invoke,
};

struct Loc
{
    Int line;
    Int col;
    bool operator<(const Loc& other)
    {
        return line < other.line || line == other.line && col < other.col;
    }
    bool operator<=(const Loc& other)
    {
        return line < other.line || line == other.line && col <= other.col;
    }
    static Loc fromSourceLoc(SourceManager* manager, SourceLoc loc, String* outFileName = nullptr);
};
List<ASTLookupResult> findASTNodesAt(
    DocumentVersion* doc,
    SourceManager* sourceManager,
    ModuleDecl* moduleDecl,
    ASTLookupType findType,
    UnownedStringSlice fileName,
    Int line,
    Int col);

} // namespace LanguageServerProtocol
back to top