Skip to content

[LSP]: provide file type detection #42

@GitMensch

Description

@GitMensch

Something like the following was suggestion by "AI" without further checks, so that has to be taken with a lot of salt...

documents.onDidChangeContent((change) => {
    const content = change.document.getText();

    // Detect GDB log content
    if (/\(gdb\)/.test(content) || /\#\d+\s+/.test(content)) {
        connection.sendNotification('customLanguageChange', { uri: document.uri, language: 'gdb-log' });
    }
    // Detect GDB commands
    else if (/\bdefine\b/.test(content) && /\bend\b/.test(content) || /\bbreak\b/.test(content)) {
        connection.sendNotification('customLanguageChange', { uri: document.uri, language: 'gdb' });
    }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions