Skip to main content

IDE Integrations

Idiomark provides integrations with popular AI-powered IDEs to help you generate code that matches your unique developer style. Using IdiomarkD (Idiomark for Developers) profiles, you can customize AI coding assistants to follow your conventions, preferences, and patterns.

Overview​

IdiomarkD profiles capture your behavioral coding patterns:

DimensionWhat It CapturesImpact on AI
Cognitive StyleProblem-solving approach, learning styleHow AI explains solutions
Code StructureFunction length, complexity tolerance, organizationCode structure suggestions
Naming ConventionsVariable, type, constant namingVariable names in suggestions
Error HandlingFail-fast vs graceful, logging levelError patterns in code
TestingCoverage threshold, mock strategyTest generation style
Code ReviewFocus areas, nitpicksReview comments style
What is IdiomarkD?

IdiomarkD (Idiomark for Developers) is an extension of the Idiomark protocol specifically designed for developer behavioral profiles. It uses profile_type: "developer" to distinguish from general personality profiles. See IdiomarkD Documentation for more details.


Choose Your IDE​

GitHub Copilot Integration​

The @idiomark/copilot-integration package provides integration with GitHub Copilot in VS Code.

Installation​

# From the monorepo
cd packages/copilot-integration
npm install
npm run build

Configuration​

1. Create a IdiomarkD Profile​

First, create your developer profile using the Idiomark CLI:

# Analyze your codebase to generate a IdiomarkD profile
npx @idiomark/core analyze-code ./src --format=idiomarkd > my-developer-profile.idiomarkd.json

2. Set Up Environment​

# Set the profile path
export IdiomarkD_PROFILE=/path/to/your/profile.idiomarkd.json

3. VS Code Settings​

Add to your .vscode/settings.json:

{
"github.copilot.inlineSuggest.count": 5,
"github.copilot.enable": {
"*": true
}
}

Programmatic Usage​

import { createCopilotIntegration, COPILOT_LIMITATIONS } from '@idiomark/copilot-integration'

// Initialize integration
const integration = createCopilotIntegration({
profilePath: '/path/to/profile.idiomarkd.json',
debug: true
})

const result = await integration.init()

if (!result.success) {
console.error('Failed to initialize:', result.error)
}

// Get the active profile
const profile = integration.getActiveProfile()
console.log('Profile loaded:', profile?.metadata?.identity?.name)

// Check limitations
console.log('Known limitations:', COPILOT_LIMITATIONS)

Profile Structure for Copilot​

{
"idiomark": "1.1.0",
"profile_type": "developer",
"metadata": {
"identity": {
"name": "Developer Name"
}
},
"behavioral": {
"cognitive_style": {
"problem_solving": "iterative_refinement",
"learning_style": "experimental",
"documentation_preference": "code_first_comments_selective"
},
"code_structure": {
"functional_preference": 0.7,
"max_function_length": 25,
"complexity_tolerance": "moderate",
"file_organization": "co-located"
},
"naming": {
"philosophy": "descriptive_over_brief",
"conventions": {
"variables": "camelCase",
"types": "PascalCase",
"constants": "UPPER_SNAKE"
}
},
"error_handling": {
"philosophy": "graceful_degradation",
"fail_fast": false,
"error_context": "on_error_only",
"logging_level": "warn"
},
"testing": {
"temperament": "pragmatic_not_zealot",
"coverage_threshold": 0.7,
"test_external_dependencies": true,
"mock_strategy": "external_only"
}
}
}

Limitations​

Important Limitations

GitHub Copilot's public API has significant limitations for custom integrations:

  1. No System Prompts: Copilot Chat API does not support custom system prompts
  2. Configuration Only: Can only inject via VS Code workspace configuration
  3. No Runtime Context: Cannot modify Copilot context after initialization
  4. Token Limit: Profile injection uses suggestion tokens

Workarounds​

Since Copilot's API is limited, use these alternative approaches:

Configuration Comments​

Add special comments to your code for Copilot to recognize:

// @idiomarkd-config
// Developer: Senior Full Stack Developer
// Problem Solving: iterative_refinement
// Learning: experimental
// Functional: 0.7
// Naming: camelCase

Custom Snippets​

Generate VS Code snippets matching your style:

// .vscode/snippets.code-snippets
{
"Error Handler": {
"prefix": "eh",
"body": [
"try {",
" $1",
"} catch (error) {",
" console.warn('[${2:module}]', error)",
" $3",
"}"
],
"description": "Error handler with graceful degradation"
}
}

General Integration Patterns​

Profile Loading Pattern​

Both integrations follow a similar pattern for loading profiles:

interface IntegrationOptions {
/** Path to IdiomarkD profile file */
profilePath?: string
/** Enable debug logging */
debug?: boolean
}

interface IntegrationResult {
success: boolean
profile?: DevBehavior
error?: string
}

Environment Detection​

Both integrations detect their respective environments:

// Copilot environment detection
const isCopilot = typeof window !== 'undefined' && (
'vscode' in (window as any).constructor.name ||
'github.github' in (window as any).document.URL
)

// Cursor environment detection
const isCursor = !!process.env.CURSOR_VERSION ||
(typeof window !== 'undefined' &&
'cursor' in (window as any).navigator.userAgent.toLowerCase())

Profile Validation​

All profiles are validated before use:

// Required fields for IdiomarkD profiles
const requiredFields = {
idiomark: 'string', // Version string
profile_type: 'developer', // Must be "developer"
behavioral: {
cognitive_style: 'object',
code_structure: 'object',
naming: 'object',
error_handling: 'object',
testing: 'object'
}
}

Creating a IdiomarkD Profile​

From Existing Code​

# Analyze your local codebase
npx @idiomark/core analyze-code ./src --format=idiomarkd > profile.idiomarkd.json

# Analyze specific files
npx @idiomark/core analyze-code ./src/components/*.tsx --format=idiomarkd

# Analyze with sample size limit
npx @idiomark/core analyze-code ./src --samples=50 --format=idiomarkd

Manual Creation​

Create a profile manually based on your preferences:

const profile = {
idiomark: "1.1.0",
profile_type: "developer",
metadata: {
identity: {
name: "Your Name"
}
},
behavioral: {
cognitive_style: {
problem_solving: "iterative_refinement", // or: decomposition, pattern_matching
learning_style: "experimental", // or: documentation_first, tutorial_based
documentation_preference: "code_first_comments_selective" // or: comments_first, minimal
},
code_structure: {
functional_preference: 0.7, // 0-1 scale
max_function_length: 25,
complexity_tolerance: "moderate", // low, moderate, high
file_organization: "co-located" // or: feature_based, layer_based
},
naming: {
philosophy: "descriptive_over_brief", // or: concise_practical
conventions: {
variables: "camelCase",
types: "PascalCase",
constants: "UPPER_SNAKE",
files: "kebab-case"
}
},
error_handling: {
philosophy: "graceful_degradation", // or: fail_fast, defensive
fail_fast: false,
error_context: "on_error_only", // or: always_include_trace
logging_level: "warn" // debug, info, warn, error
},
testing: {
temperament: "pragmatic_not_zealot", // or: tdd_advocate, coverage_maximalist
coverage_threshold: 0.7,
test_external_dependencies: true,
mock_strategy: "external_only" // or: none, all, mixed
}
}
}

Troubleshooting​

Common Issues​

"Copilot environment not detected"​

Ensure you're running within VS Code with the Copilot extension installed and enabled.

Solution:

# Verify VS Code is running
code --version

# Check Copilot extension is installed
code --list-extensions | grep copilot

"Failed to load profile"​

The profile file may be invalid or missing required fields.

Solution:

# Validate the profile
idiomark validate profile.idiomarkd.json --strict

# Check file exists
ls -la $IdiomarkD_PROFILE

"No runtime context modification"​

This is a known limitation of Copilot's API.

Solution: Use configuration comments or custom snippets as workarounds.

Debug Mode​

Enable debug mode for verbose logging:

const integration = createIntegration({
profilePath: '/path/to/profile.idiomarkd.json',
debug: true // Enable debug logging
})

Profile Validation Errors​

ErrorCauseSolution
Invalid IdiomarkD file: must have profile_type "developer"Wrong profile typeAdd "profile_type": "developer"
Invalid IdiomarkD file: missing behavioral layerMissing required fieldAdd behavioral object
Failed to load profile: ENOENTFile not foundCheck file path
Failed to load profile: Unexpected tokenInvalid JSONValidate JSON syntax

API Reference​

Copilot Integration​

import {
createCopilotIntegration,
COPILOT_LIMITATIONS,
COPILOT_WORKAROUNDS
} from '@idiomark/copilot-integration'

// Types
interface CopilotIntegrationOptions {
profilePath?: string
debug?: boolean
}

interface CopilotIntegrationResult {
success: boolean
profile?: DevBehavior
method: 'config' | 'comment' | 'environment'
error?: string
}

// Methods
const integration = createCopilotIntegration(options)
await integration.init()
integration.getActiveProfile()
integration.isActive()
integration.dispose()

Cursor Integration​

import {
createCursorIntegration,
initCursorIntegration
} from '@idiomark/cursor-integration'

// Types
interface CursorIntegrationOptions {
profilePath?: string
debug?: boolean
maxTokens?: number
}

interface CursorIntegrationResult {
success: boolean
profile?: DevBehavior
promptInjection?: string
error?: string
}

// Methods
const integration = createCursorIntegration(options)
await integration.init()
integration.getActiveProfile()
integration.getPromptInjection()
integration.isActive()
integration.dispose()

// Helper function
const result = await initCursorIntegration()

See Also​